Create local location based notifications in swift

后端 未结 2 449
一向
一向 2021-02-04 21:28

I\'m a relatively new swift developer and I\'ve heard in iOS 8 you can send local notifications based on a users Location. I have had a look at some code, particularly this one

2条回答
  •  一生所求
    2021-02-04 21:50

    The SetSDK allows you to set this up really really simply now. Basically, just a few lines of code.

    SetSDK.instance.onDeparture(from: .any) { departed in
        /* do your Swift things here */
       let departureCoordinates = departed.location
       // keep going
    }
    
    SetSDK.instance.onArrival(to: .any) { arrived in
        /* do your Swift things here */
       let arrivalCoordinates = arrived.location
       // keep going
    }
    

    The SDK handles doing the persistent location collection without killing your battery and the locations that it sends notifications for are continuously being learned, so no manual entry of geofences or anything like that. Just start it and go.

提交回复
热议问题