61 lines
2.1 KiB
Swift
61 lines
2.1 KiB
Swift
//
|
|
// 2_WelcomeViewController.swift
|
|
// Guibe
|
|
//
|
|
// Created by Max Hunt on 28/05/2019.
|
|
// Copyright © 2019 8. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import CoreLocation
|
|
|
|
class W2lcomeViewController: UIViewController, CLLocationManagerDelegate {
|
|
|
|
let locationManager = CLLocationManager()
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
// sleep(1)
|
|
self.locationManager.requestAlwaysAuthorization()
|
|
|
|
let xstatus = CLLocationManager.authorizationStatus()
|
|
if xstatus == CLAuthorizationStatus.authorizedAlways || xstatus == CLAuthorizationStatus.authorizedWhenInUse{
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
|
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen3") as! S3artViewController
|
|
nextViewController.modalTransitionStyle = .crossDissolve
|
|
self.present(nextViewController, animated: true, completion: nil)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Do any additional setup after loading the view.
|
|
}
|
|
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
|
|
if status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse{
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen3") as! S3artViewController
|
|
nextViewController.modalTransitionStyle = .crossDissolve
|
|
self.present(nextViewController, animated: true, completion: nil)
|
|
}
|
|
}
|
|
if status == CLAuthorizationStatus.denied{
|
|
//bad
|
|
|
|
}
|
|
}
|
|
|
|
/*
|
|
// MARK: - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
// Get the new view controller using segue.destination.
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
}
|