Created
April 9, 2018 14:50
-
-
Save chengyang1380/aa7a0bcf588b837f4ff111302a75d1f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 創建觸發條件,這裡是設定每天8:30 | |
var date = DateComponents() | |
date.hour = 8 | |
date.minute = 30 | |
let trigger = UNCalendarNotificationTrigger(dateMatching: date, repeats: true) | |
// 創建觸發條件,這裡是設定座標經緯度 | |
let center = CLLocationCoordinate2D(latitude: 37.335400, longitude: -122.009201) | |
let region = CLCircularRegion(center: center, radius: 2000.0, identifier: "Headquarters") | |
region.notifyOnEntry = true | |
region.notifyOnExit = false | |
let trigger = UNLocationNotificationTrigger(region: region, repeats: false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment