by Ossi Hanhinen, @ohanhi
with the support of Futurice 💚.
Licensed under CC BY 4.0.
// SwiftyJSON.swift | |
// | |
// Copyright (c) 2014 Ruoyu Fu, Pinglin Tang | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
$ xcode-select --install
$ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
$ xcode-select -p
class PushNotificationManager { | |
class var isPushNotificationEnable: Bool { | |
let osVersion = UIDevice.currentDevice().systemVersion | |
if osVersion < "8.0" { | |
let types = UIApplication.sharedApplication().enabledRemoteNotificationTypes() | |
if types == UIRemoteNotificationType.None { | |
// push notification disabled | |
return false | |
}else{ | |
// push notification enable |
class SmartKeyBase: Equatable, Hashable { | |
private let defaults = NSUserDefaults.standardUserDefaults() | |
private(set) static var allKeys = Set<SmartKeyBase>() | |
let name: String | |
static func removeAllValues() { | |
allKeys.forEach { $0.removeValue() } | |
} | |
init(_ name: String) { |
import Foundation | |
extension String | |
{ | |
var length: Int { | |
get { | |
return self.characters.count | |
} | |
} | |