Post

Replies

Boosts

Views

Activity

Reply to Why is the Button not working? SwiftUI
try the following, It gets rid of the layout constraint issues and shows the My Text Label, using an EmptyView as the destination and the help button in the navbar. There is a certain view hierarchy that must be kept to avoid layout issues. struct ContentView: View {     @State var selection: String?     let id = "1"     var body: some View {         test     }     var test: some View {         NavigationView {             NavigationLink(tag: id, selection: $selection) {                 EmptyView()                     .navigationTitle("Welcome")             } label: {                 Text("My Test")             }             .toolbar {                 Button("Help") {                     print("Help tapped!")                 }             }         }     } Example two without the NavigationLink struct ContentView: View {     var body: some View {         nonavLink     }     var nonavLink: some View {         NavigationView {             Text("My Test")             .toolbar {                 Button("Help") {                     print("Help tapped!")                 }             }         }         .navigationTitle("Welcome")     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to Xcode 13.2.1 Preview
Notes The command below also works with 13.x.x https://developer.apple.com/documentation/xcode-release-notes/xcode-13_3-release-notes Xcode SwiftUI Previews may occasionally fail with an error message about a modified .hfile, such as “file Header.h has been modified since the module file Module.pcm was built: mtime changed.” (85938686) Workaround: Delete the Clang module cache by running the following command in Terminal: rm -rf "$TMPDIR/../C/clang/ModuleCache". Then try to preview the file again.
Feb ’22
Reply to How can I refactor a GeometryReader?
Value types in swift cannot be subclassed because they are not objects nor are they class types. You can try extending with the use of extensions but the internal behaviours of the components are private APIs except for what is already available as public APIs.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’22
Reply to Why is the Button not working? SwiftUI
try the following, It gets rid of the layout constraint issues and shows the My Text Label, using an EmptyView as the destination and the help button in the navbar. There is a certain view hierarchy that must be kept to avoid layout issues. struct ContentView: View {     @State var selection: String?     let id = "1"     var body: some View {         test     }     var test: some View {         NavigationView {             NavigationLink(tag: id, selection: $selection) {                 EmptyView()                     .navigationTitle("Welcome")             } label: {                 Text("My Test")             }             .toolbar {                 Button("Help") {                     print("Help tapped!")                 }             }         }     } Example two without the NavigationLink struct ContentView: View {     var body: some View {         nonavLink     }     var nonavLink: some View {         NavigationView {             Text("My Test")             .toolbar {                 Button("Help") {                     print("Help tapped!")                 }             }         }         .navigationTitle("Welcome")     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to How to make this scrollable view without disturbing the below text which stays there and I can scroll the images one above other.
VStack { ScrollView { //All of the UI content that should scroll } Pager { ... } Text("The Content outside of the ScrollView stays fixed") }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Using JSON file populate list to different views
See the Apple Fruta example project.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Xcode Error 254 When Running Linux Executable File
if it was built for Linux run it on Linux.
Replies
Boosts
Views
Activity
Jan ’22
Reply to Xcode bug in SwiftUI previews when using Core Data
Yeah that's dirty little bug in the template. Not sure what its creator was thinking.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to SwiftUI: How to go back to the previous instance in a navigationlink in a list
That should be embedded in a NavigationView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to How to move objects to the right side?
Confirm the base language of the project used for localization. This should happen automatically based on your computer's or mobile device's default language, the project's default or base localization language without you having to force it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How can I let my app run like Google Maps even when the app is in the background and still continue to fetch the user's real location?
You can begin by reading here. https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html#//apple_ref/doc/uid/TP40009497-CH9-SW1
Replies
Boosts
Views
Activity
Feb ’22
Reply to Xcode 13.2.1 Preview
Notes The command below also works with 13.x.x https://developer.apple.com/documentation/xcode-release-notes/xcode-13_3-release-notes Xcode SwiftUI Previews may occasionally fail with an error message about a modified .hfile, such as “file Header.h has been modified since the module file Module.pcm was built: mtime changed.” (85938686) Workaround: Delete the Clang module cache by running the following command in Terminal: rm -rf "$TMPDIR/../C/clang/ModuleCache". Then try to preview the file again.
Replies
Boosts
Views
Activity
Feb ’22
Reply to How can I refactor a GeometryReader?
Value types in swift cannot be subclassed because they are not objects nor are they class types. You can try extending with the use of extensions but the internal behaviours of the components are private APIs except for what is already available as public APIs.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to C++ include path completion for header using .hpp as a suffix
Yes, once you include them. Wrap the c++ methods into objective-c calls. then annotate the objective-c calls for use in swift.
Replies
Boosts
Views
Activity
Feb ’22
Reply to why app crashes when I use localization and LocationButton in swiftui? I get this error:Thread 1: "Invalid parameter not satisfying: width && height"
Sounds like you're passing .infinity to a width and height parameter of a frame. it might be best to use a GeometryReady to get a width & height as the minWidth & minHeight and use .infinity as the maxWidth & maxHeight or just use an absolute w x h.
Replies
Boosts
Views
Activity
Feb ’22
Reply to Any news from Apple on the random disk ejection fault?
This is not the place for the such questions: please go here: https://discussions.apple.com/welcome
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to my segue transition goes upward instead of sideways and does not completely cover screen
Are there any performSeque implementations in MainViewController?
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Replies
Boosts
Views
Activity
Feb ’22