Post

Replies

Boosts

Views

Activity

Reply to SwiftUI image from Bundle.main not working
Hi, when you develop a swift package, you should add directly to it bundle resources that should be used. Swift Package dont' have access directly to app asset, because are package :) And should developed as reusable resources, used in another app without modification. Here the docs for add bundle resources to Swift Package https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package Bye Rob
Oct ’24
Reply to SwiftUI image from Bundle.main not working
Hi, mmm it seems an interesting use case, but what are the benefits on this approach? The main bundle should be app single dependency. if we have the needs of pass data to the package itself , probably some sort of dependency injection could be the best option. I'm not sure that put a main.bundle a shared resources container on different framework/package is the best approach, but probably I miss some point. Bye Rob
Oct ’24
Reply to iOS 18 tabbar flickers and then disappears
Hi @codercd , I tried to reproduce the problem on tab disappearing and it seem has you described. It could be correlated to the animated flag, try to simply set the flag animated to false as follow: override func viewDidLoad() { super.viewDidLoad() let vcC = ViewControllerC() vcC.hidesBottomBarWhenPushed = true navigationController?.pushViewController(vcC, animated: false) } On my sample project the behaviour seems ok (tested on iOS 18 simulator). Bye Rob
Oct ’24
Reply to How to skip library check in framework
Hi @fkdjskfjdskfsdf , probably it's not be successful, but the problem seems to be in the generation of the HansTranslation framework. Try to change the minimum deploy target of HansTranslation framework project generation to 17.6 , build and see if some warning are displayed. Then, try to use the generated framework on iOS 18 and iOS 17.6 , if you are lucky should work Bye Rob
Oct ’24
Reply to preferredColorScheme not working with Xcode 16
Hi @Claude31 , I've just make a debug session on Mac OS Sonoma (14.6) and same project seems doesn't work. Toogle change isDarkMode property correctly, but SwiftUI rendering view is not raised on ContentView. It seems that binding on AppStorage variable is not raised. Note that after close and reopening app , value are read correctly from ContentView. Strange behaviour. Anyway, take this as suggestion, I should not use @AppStorage in this way. Probably using a custom init on ContentView with a data binding property that is propagated on ContentView itself could resolve this issue. Bye Rob
Oct ’24
Reply to App crashes at launch on missing symbol AVPlayerView... except on first launch
Hi @Stokestack , really strange behaviour. AVPlayerView is really an old view present on AVkit on Mac OS 10.9, and it is used on QuickTime App itself. https://developer.apple.com/documentation/avkit/avplayerview If you can generate some sort of sample project and tell which is your enviromment, probably could help. Error simply tell that no AVPlayerView is found on Mac OS, that is really strange Bye Rob
Oct ’24
Reply to App crashes at launch on missing symbol AVPlayerView... except on first launch
Hi @Engineer @Stokestack , as @Engineer mentioned, it could be a issue on iOS side. If this is the use case, @Stokestack , you should wrap piece of code using AVPlayerView with this conditional compilation : // Swift #if targetEnvironment(macCatalyst) // Code specific to Mac. #else // Code to exclude from Mac. #endif // Objective C #if TARGET_OS_MACCATALYST // Code specific to Mac. #else // Code to exclude from Mac. #endif Bye Rob
Oct ’24
Reply to StateObject isn't being deallocated whilst it's containing View has disappeared
Hi @badf00d , really interesting behaviour. For completeness, I tried your example app on iOS and I confirmed that Copmanion state object is no deallocate since the next SwiftUI rendering (you could simply make a touch or click and see the deinit call) see log CheckPasscodeView appear CheckPasscodeView disappear ☠️ Copmanion died This behaviour is equal on iPad 18.0 Simulator , but on Mac OS the behaviour seems as expected: CheckPasscodeView appear ☠️ Copmanion died CheckPasscodeView disappear Note that at first touch object is deallocated even on iOS use case, then I'm not sure could be a issue. Bye Rob
Oct ’24
Reply to UICollectionView Move Item Method Not Called in iOS 18
Hi @cloneze , first at all, UICollectionView is probably one of the more complex UIKit class and is in continuous evolution at each iOS release. Come back to your issue, probably the collection view delegate protocol method mentioned is called during a moving of the cell. If the drag and drop functionality is implemented, I will try to use this method to trace the movement of the cell during a drag and drop use case: func collectionView( _ collectionView: UICollectionView, dropSessionDidUpdate session: any UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath? ) -> UICollectionViewDropProposal { print("🐸 Move") return UICollectionViewDropProposal.init(operation: .move, intent: .insertIntoDestinationIndexPath) } I tested on a simple app with collection view controller with drag and drop enabled, and it seems that this is called correctly. Here some details: https://developer.apple.com/documentation/uikit/views_and_controls/collection_views/supporting_drag_and_drop_in_collection_views Bye Rob
Oct ’24
Reply to Binding NSPopUpButton to an NSMutableArray
Hi @that_aint_it_chief , well this question about Mac OS brings me to all past days on I started developing on a Macintosh || Classic with Borland C and Inside Macintosh :) Try to help you, I think that you should use this bindings from inspector tab: Bind Content -> yourViewControllerClass ControllerKey -> tableCities If for example you should have some more structured model (for example an array of objects with field title for example), then you should use something like this: Bind Content Values -> yourViewControllerClass ControllerKey -> arrangedObjects Model Key Path: title Here documentation on bindings https://developer.apple.com/library/archive/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSPopUpButton.html Bye Rob
Oct ’24
Reply to MapCameraPosition camera region rect item all of them are nil
Hi @Tennaaaaaaa , mmm I'm not sure about what is your question, but SwiftUI Map shows you the MapKit View and is really powerful, because you could integrate in one line of code the MapKit UIKit framework in SwiftUI. This is coherent with nil values you see, MapKit doesn't refresh position, only display a Map. But if you want a system that tracking in real time current location of user and display it on MapKit View, you should implement an CLLocationManager and its delegates methods. If this is the scope of your app, please check on following documentation link https://developer.apple.com/documentation/corelocation/cllocationmanager Bye Rob
Oct ’24
Reply to My Swift concurrency is no longer running properly and it's screwing up my SwiftData objects
Hi @SimplyKyra , this is really and interesting approach with SwiftData (wrapper on CoreData framework) and concurrency programs. The issue could be in the creation of the sub issue inside the taskGroup. I think that the problem could be in a concurrency access on ModelContext inside all single task groups. Putting a @MainActor on this method @MainActor internal final func createSubIssue(in container: ModelContainer, issueID: PersistentIdentifier, name: Int) async -> String? resolve the concurrency problem on ModelContext, but I'm not sure could be the right approach, I attached a screenshot. On CoreData framework there is the concept of background managed context (model Context is the SwiftUI name of this object). Think you should follow this approach on SwiftUI https://developer.apple.com/documentation/coredata/using_core_data_in_the_background Bye Rob
Oct ’24
Reply to How to observe AVCaptureDevice.DiscoverySession devices property?
Hi @Kusaanko , really interesting question. Try to use this options [.initial, .new] in your addObserver options method: https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions/1413959-initial From the docs it seems that the .initial option behaves las follow: When this option is used withaddObserver(_:forKeyPath:options:context:) a notification will be sent for each indexed object to which the observer is being added. Bye Rob
Oct ’24
Reply to PHPickerViewController translucency
Hi @wolfson , unfortunately I don't think you should change this behaviour, because PHPickerViewController could not be subclasses, and even if you modify opacity could create problems, see doc for details. https://developer.apple.com/documentation/photokit/phpickerviewcontroller Bye Rob
Oct ’24