Post

Replies

Boosts

Views

Activity

Vision OS Navigation Links stop highlighting and not selectable
It seems to stop working after I navigate to a View that has a UIRepresentable holding a MapKit map. This was while I was testing in AVP device but I couldn't duplicate it in the simulator. The top view has the NavigationStack. The top view is a lazygrid that has a custom "GridItem" view I made which either sets the string value of a NavigationLink or in some cases I use a button to open a url in Safari. NavigationLink(value: button.name) { //a menu with an Image() and Text() } // or some menus open to Safari if button.name == "Parking Site" { //a button with an action the opens to Safari } For a NavigationLink string value, the navigationDestination takes them to the view based on the selected value. For example, it loads DirectoryView() for "Directory" .navigationDestination(for: String.self) { textValue in if textValue == "Directory" { DirectoryView() ... It all works at the start, but after visiting a UIRepresentable and returning back to the parent menu view - all the NavigationLinks lose the highlight and can no longer be selected. I'll try to scale it down to a more simple structure and also test the same code on an iOS project to see if it's a bug for AVP.
1
0
324
Mar ’24
Disappointment with SwiftUI
I hope I'm not wasting space here, but I just want to express how SwiftUI is only a replacement if you do without many UIKit features. For example, I want to enable hidesBottomBarWhenPushed. This feature does not exist for SwiftUI tab view. The "answer" is to figure out some way to do this in a custom way. It's just that I have to hold back my progress when converting my UIKit app to SwiftUI. I hope this gets somewhat easier with experience. I mean we know that the navigation isn't connected the same way as UIKit, so some things we just have to let go perhaps. You get some big wins (a simpler way to layout) but then when you hit a stopping point with the UI - Another example, I couldn't figure out with MapView for something familiar and well documented in UIKit. So what did I do? Of course - wrap it in another UIViewControllerRepresentable.
1
0
392
Mar ’24
Im trying to conditionally include a delegate
I want to conditionally add a delegate for only iOS (not VisionOS) This is where I assign a ViewController that is a delegate. The Framework below is not compatible with VisionOS. I get an error when I compile: "cannot assign ViewController to delegate FrameworkDelegate" #if os(iOS) //for iOS target use VC for delegate assignment self.framework.delegate = delVC #endif Here is where I have the ViewController header (ViewController.h) #if OS_TARGET_IOS #import "MyProject-Swift.h" //for iOS target use delegate @interface AttendanceViewController : UIViewController<FrameworkDelegate> #else //for VisioOS target, no delegate @interface AttendanceViewController : UIViewController #endif Even though I specify in both places that the framework is used for iOS, the compiler does not allow it to compile. Does objective-c complicate the matter? I like my library function in Swift!
1
0
491
Mar ’24
Is there a convenient way to exclude files based on an OS filter?
I have an existing app which I converted to Vision OS. The iOS app is using package dependencies which are not compatible with VisionOS. I filtered only iOS from the package under Frameworks, Libraries.. for the target. And then I used #if(os) to exclude the entire content of the swift file that is using the package. Is there a convenient way to exclude entire files based on OS in the same sense that Package has an OS filter?
1
0
368
Mar ’24
Calling an URSession task in background and display local notification
I would like to call a "GetMessages" API every 10 minutes while the app is not active or shutdown. if a message is returned, display the message as a local notification Will the background api run if the app is shut down? An example of this is when an email app shows a notification. Can they pull from their server while the app is not running or do they use the push notification service. I know that calendar events can be scheduled locally and for location changes, but I don't know if calling a api task with the app not running is possible.
1
0
636
Dec ’23
When is iOS 17 the only option to update?
Currently, users can update iOS 16.7 and optionally install iOS 17. At what point is iOS 17 the only version to update? I don't want to have over half the app users on the iOS 16.7 version and not able to update my app. Would they still be able to install the "outdated" iOS 16.7 version or does the app store just not let them find the app if I have updated to iOS 17?
0
0
489
Oct ’23
Finding source of crash
I've been debugging the source of a crash bug (right on app launch!) and it reminded me that some of my old code is sort of a mess. Do you have luck with static analyzer or other Xcode tools? For starters maybe I'll try to scan some Apple sample code to see how well it does, haha.
5
0
1.8k
Aug ’22
Swift UI backward compatibility
I am new to SwiftUI and thinking of converting my UIKit app. My deployment target is the last version of iOS 13. If I compile the app to iOS 16 will the new SwiftUI features be compatible on an iOS 13 device or should I wait until I drop support? For example, I don't want to have to add two versions of navigation view by adding "if version" block for the new NavigationStack since I have not used SwiftUI previously.
1
0
1.6k
Aug ’22