Skip to main content
Filter by
Sorted by
Tagged with
3 votes
2 answers
1k views

In Swift, this crashes at runtime: class EmptyData: BindableObject { let didChange = PassthroughSubject<EmptyData, Never>() } struct RandomView : View { @EnvironmentObject var ...
9 votes
2 answers
2k views

I have Catalina macOS version (10.15) installed and still the canvas is not showing up. The error message I get from Xcode is Select a scheme that builds a target which contains the current file, ...
0 votes
1 answer
71 views

How do I load a View with a View name? For example, I have a struct TextPage: View , how do I load this View via the string TextPage ?
2 votes
0 answers
920 views

I constructed a BindableObject tied to my custom view. I wanna update the array of items in this class // in my vm: class ViewModel { func fetched() { listView....
1 vote
2 answers
782 views

I have the following layout achieved in SwiftUI: VStack { TextField(...) TextField(...) Button(...) } I tried making my VStack to be 50% of the superview, so I added the following modifier: ...
1 vote
1 answer
1k views

I want to display an MKMapView with a height that is the half of the screen's height and ignoring the top edge. This is my code: import SwiftUI import MapKit struct ContentView : View { var body:...
1 vote
0 answers
238 views

I have converted my existing Xib UI in SwiftUI. Is it possible to use SwiftUI in existing UITableView and UICollectionView? Here is the code i have done in SwiftUI struct LandmarkList: View { @...
3 votes
1 answer
9k views

I have added datePicker for now inside HStack. I want to show datePicker only when textField is in editing mode. struct EditProfile: View { @Binding var profile: Profile var body: some View { ...
1 vote
1 answer
2k views

In Swift 5.1 there are opaque types. I see that e.g. body is a required protocol variable. It's contract is defined as follows: var body: Self.Body { get } It means we should be able to mark body as ...
118 votes
2 answers
13k views

It seems like Apple's new SwiftUI framework uses a new kind of syntax that effectively builds a tuple, but has another syntax: var body: some View { VStack(alignment: .leading) { Text("...
1 vote
1 answer
169 views

In UIKit we used the autolayout system. What layout system does SwiftUI use? How does it layout the UIView in the canvas?
14 votes
3 answers
7k views

I'm following the first tutorial in Apple's series explaining how to create & combine views in a SwiftUI application. In step 8 of section 6 in the tutorial, we need to insert the following code: ...
3 votes
2 answers
3k views

In this video: https://developer.apple.com/videos/play/wwdc2019/103/, the following snippet of code is shown at around 15:30: ... ForEach(ContentSizeCategory.common.identified(by: \.self)) ... What ...
2 votes
1 answer
1k views

I am trying to run the Landmark sample for the SwiftUI, but getting following error Error Domain=IXErrorDomain Code=29 "A coordinated install for com.example.apple-samplecode.Landmarks is already ...
6 votes
1 answer
8k views

I have created new app with swiftUI in xcode11. and not able to find Xcode preview like shown in wwdc19.
2 votes
2 answers
2k views

I'm trying to get my SwiftUI Demo running but I get weird compiler issues: 'Color' is not convertible to 'Color?' Unable to infer complex closure return type; add explicit type to disambiguate ...
2 votes
1 answer
244 views

As seen in the handling user input tutorial. struct LandmarkList: View { @State var showFavoritesOnly = true var body: some View { NavigationView { List { ...

1
832 833 834 835
836