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.
Post
Replies
Boosts
Views
Activity
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.
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!
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?
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.
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?
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.
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.
When I add a pass to wallet, the user can use an action button to send the pass to through email, messages, etc. Is there a way to disable that for a pass?
I could add a screen shot, but it basically shows the action menu and adds a subtitle "gift card" (I'm using the storeCard for the template, but I'm not using it for a gift card.)
I wanted to give someone App Manager access to a developer, but she claimed she needed Admin access:
Apple recently made a change to the submission process where they need an account Admin to answer privacy and usage questions about the app during the submission process.
Is this correct?