Post

Replies

Boosts

Views

Activity

ARKit 4 recommendation for photo sharing
A common AR use case is for a user to view a model in augmented reality and once correctly composed wish to share that view. Is there a recommended approach with ARKit 4 to capture a photo of the AR scene then invoke a share sheet to send to a contact or save to the camera roll? Best practice options for both UIKit and SwiftUI would be ideal. Additionally any advice on embedding GPS data into the image as you’d expect to get with a regular photo taken by the camera would be most appreciated.
0
0
381
Jun ’20
How to offer Object & AR views of a model
It's possible to view example AR models in Safari on an iOS device on this page: https://developer.apple.com/augmented-reality/quick-look/ On my iPhone, after clicking on a model I have the option to view the model in "AR" or "Object" modes, where Object allows you to view the model just with a white background. In my app I'm displaying an AR model using AR Quick Look (called in a SwiftUI view). ARQuickLookView(name: "my-AR", arFileType: "reality") …which allows the user to view the model in "AR" mode, but I don't know how to enable "Object" mode as described above. Ideally I'd like to lock the view to "Object" mode only in this part of the app. How can I do that?
2
0
935
Jun ’20
decode JSON UUID correctly
Hello,This is a beginner question but it has me stumped. I have a JSON file in the bundle that includes valid UUIDs generated from within Xcode in the format "D9BB6CD0-FBB9-49B9-9076-07D49E1707B2". I want to store these in a UUID variable within a struct.struct model: Codable { var id: UUID var name: String … }I use a standard JSONDecoder() call to import the models.let importedModels = Bundle.main.decode([model].self, from: "models.json")All of the other JSON data imports correctly. In fact it's been working so well it took me a while to notice that the UUIDs were not being populated. I just get a nil value for variable id.I believe what's happening is that the decoder isn't initialising the UUID from the string properly and it's quietly failing (on UUID data only). But I don't understand why because in the definition for public struct UUID in Foundation it says, /// Create a UUID from a string such as "E621E1F8-C36C-495A-93FC-0C247A3E6E5F". /// /// Returns nil for invalid strings. public init?(uuidString string: String)So if the string is valid is should work and I am using valid strings.E621E1F8-C36C-495A-93FC-0C247A3E6E5F // Foundation documentation D9BB6CD0-FBB9-49B9-9076-07D49E1707B2 // from models.jsonAny help greatly appreciated.
5
0
5.7k
Jan ’20
Where to import static JSON in SwiftUI?
I have a static JSON file that's used as a data structure for importing information into my app. The JSON file doesn't change - if the content of the JSON file ever needs to be updated I'm happy (at this time) to issue an update in a point release. The JSON decoding only needs to be done once with the decoded result stored in an Environment variable for future reference. While it shouldn't be too computationally intensive to re-parse the JSON there really isn't any need once it's been done once.So my question is - in a SwiftUI app where should I run the JSON decoder? I've looked at AppDelegate.swift, SceneDelegate.swift and ContentView.swift but I'm not sure if any of these are the right place to run a once-off decoder. Any advice appreciated.
2
0
1.3k
Jan ’20