Post

Replies

Boosts

Views

Activity

Presenting immersive content in UIKit app
I have a UIKit app and would like to provide spacial experience when run on VisionOS. I added VisionOS support, but not sure how to present an immersive view. All tutorials are in SwiftUI, but my app is in UIKit. This is an example from a SwiftUI project, but how how do I declare this ImmersiveView in UIKit? struct VirtualApp: App { var body: some Scene { WindowGroup { ContentView() }.windowStyle(.volumetric) ImmersiveSpace(id: "ImmersiveSpace") { ImmersiveView() } } } and in UIKit how do I make the call to open the ImmersiveView?
5
1
1.7k
Jul ’23
Bunlde.module In Swift Package Crashes The App
I have a Swift Package for a small feature that I'd like to use in multiple apps. All I want is to present the ViewController inside the Swift package from the app that uses it. It works fine while developing, but when creating an ipa for the app or submitting to the App Store, it stops working, and it caused the app to be rejected. In the Swift Package I have this extension to get a view controller's storyboard: public extension UIViewController{     static func getStoryboardVC() - UIViewController { let storyboard = UIStoryboard(name: String(describing: self), bundle: Bundle.module)         return storyboard.instantiateInitialViewController()!     } } and in the app I get the Swift Package's view controller like this:         let vc = ARMap.ARCameraVC.getStoryboardVC()  present(vc, animated: true, completion: nil) This works great when building in Xcode into a device, but when installing the app as an .ipa file, or submitting to the App Store it crashes with this error from the device logs: Fatal error: unable to find bundle named ARMap_ARMap: file ARMap/resource_bundle_accessor.swift, line 27 The resource_bundle_accessor that was generated looks like this: private class BundleFinder {} extension Foundation.Bundle {     static var module: Bundle = {         let bundleName = "ARMap_ARMap"         let candidates = [             Bundle.main.resourceURL,             Bundle(for: BundleFinder.self).resourceURL,             // For command-line tools.             Bundle.main.bundleURL,         ]         for candidate in candidates {             let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle")             if let bundle = bundlePath.flatMap(Bundle.init(url:)) {                 return bundle             }         }         fatalError("unable to find bundle named ARMap_ARMap")     }() } The targets in the package's manifest looks like this:     targets: [         .target(             name: "ARMap",             dependencies: [],             resources: [.process("Resources")]         ),         .testTarget(             name: "ARMapTests",             dependencies: ["ARMap"]),     ] I hope someone can spot what I'm doing wrong.
1
0
2.0k
Feb ’21