「AppDelegate」の中身についてメモ
Gameのプロジェクトを作ると、必ずテンプレートで作成されている「AppDelegate.swift」の中身についてまとめ。
import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { return true } func applicationWillResignActive(application: UIApplication) { print("アプリがバックグラウンドになりそうな時に呼ばれる") } func applicationDidEnterBackground(application: UIApplication) { print("バックグラウンドになった時") } func applicationWillEnterForeground(application: UIApplication) { print("フォアグラウンドになりそうな時") } func applicationDidBecomeActive(application: UIApplication) { print("フォアグラウンドになった時") } func applicationWillTerminate(application: UIApplication) { print("フリックしてアプリが閉じた時") }