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
import UIKit | |
import Firebase | |
import FirebaseAuth | |
class ViewController: UIViewController { | |
var microsoftProvider : OAuthProvider? | |
let kGraphURI = "https://graph.microsoft.com/v1.0/me/" | |
override func viewDidLoad() { |
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
import UIKit | |
import Firebase | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. |
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
import UIKit | |
import MapKit | |
import CoreLocation | |
class ViewController: UIViewController, MKMapViewDelegate { | |
@IBOutlet weak var mapView: MKMapView! | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
<?xml version="1.0"?> | |
<gpx version="1.1"> | |
<wpt lat="35.658626" lon="139.745471"> | |
</wpt> | |
</gpx> |
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
func isAllowReceiveNotification() -> Bool{ | |
var isAllow = true | |
notificationCenter.getNotificationSettings { (settings) in | |
// Do not schedule notifications if not authorized. | |
if (settings.authorizationStatus != .authorized || settings.alertSetting != .enabled){ | |
isAllow = false | |
} |
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
func setupLocalNotificationByRegion(){ | |
if !isAllowReceiveNotification() { | |
return | |
} | |
// setup notification content | |
let content = UNMutableNotificationContent() | |
content.title = "Tokyo Tower" | |
content.body = "Welcome to Tokyo Tower, A symbol of Japan's post-war rebirth as a major economic power!" |
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
func setupUserNotificationCenter(){ | |
notificationCenter.delegate = self | |
// request to receive notification | |
notificationCenter.requestAuthorization(options: [.alert, .sound, .badge, .carPlay], completionHandler: { (granted, error) in | |
if (error != nil) { | |
print("Notification Authorization Error: " + error!.localizedDescription) | |
}else{ |
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
func setupLocationManager(){ | |
if CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedAlways{ | |
// Request to get alwayls location authorization | |
locationManager.requestAlwaysAuthorization() | |
} | |
// set delegate for location manager | |
locationManager.delegate = self | |
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
func mapView(_ mapView: MKMapView, didUpdate userLocation: MKUserLocation) { | |
let span = MKCoordinateSpan(latitudeDelta: 0.001, longitudeDelta: 0.001) | |
let region = MKCoordinateRegion(center: userLocation.coordinate, span: span) | |
mapView.region = region | |
} |
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
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { | |
let circleRenderer = MKCircleRenderer(overlay: overlay) | |
circleRenderer.strokeColor = UIColor(red: 66/255, green: 133/255, blue: 244/255, alpha: 0.80) | |
circleRenderer.lineWidth = 1.0 | |
circleRenderer.fillColor = UIColor(red: 66/255, green: 133/255, blue: 244/255, alpha: 0.20) | |
return circleRenderer | |
} |
NewerOlder