How to get Current Location with SwiftUI?

后端 未结 3 988
你的背包
你的背包 2020-12-15 09:07

Trying to get current location with using swiftUI. Below code, couldn\'t initialize with didUpdateLocations delegate.

class GetLocation : BindableObject {         


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-15 09:40

    As of Xcode 11 beta 4, you will need to change didChange to willChange:

    var willChange = PassthroughSubject()
    
    var lastKnownLocation: CLLocation? {
        willSet {
            willChange.send(self)
        }
    }
    

提交回复
热议问题