Open ytyubox opened 5 years ago
NotificationCenter.default.addObserver( self, selector: #selector(appWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
<dict> <key>Type</key> <string>PSToggleSwitchSpecifier</string> <key>Title</key> <string>Night Mode</string> <key>Key</key> <string>isNightMode</string> <key>DefaultValue</key> <false/> </dict>
struct Theme { var isNightMode:Bool { return UserDefaults.standard.bool(forKey: "isNightMode") } var backgroundColor:UIColor { return isNightMode ? .black : .white } var foregroundColor:UIColor{ return isNightMode ? .white : .black } }
開啟設定頁的方法 UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)