iosswiftaugmented-realitylidar

Check if iOS device has LiDAR in Swift


is there a way in Swift to check if the device has a LiDAR sensor? Unfortunately I've didn't find anything in the official Apple documentary nor with internet search.

My current workaround is to determine the device type like described in this post: How to determine the current iPhone/device model?

Thanks


Solution

  • Use this code:-

    import ARKit
    
    let supportLiDAR = ARWorldTrackingConfiguration.supportsSceneReconstruction(.mesh)
    guard supportLiDAR else {
        print("LiDAR isn't supported here")
        return
    }
    

    Scene reconstruction requires a device with a LiDAR Scanner, such as the fourth-generation iPad Pro.

    reference:- https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration/3521377-supportsscenereconstruction