Instructions on how to setup a secured Jenkins CI on a Mac.
All of these operations are done with your admin user.
Install the command line developer tools.
func convertArray(array: [Int]) -> [String]? { | |
// Nothing to do. Exiting. | |
guard array.count > 0 else { return nil} | |
// Things to convert. | |
var stringArray = [String]() | |
for int in array { | |
let string = "\(int)" |
let fibs = [0, 1, 2, 3, 4] | |
var squared: [Int] = [] | |
for fib in fibs { | |
squared.append(fib * fib) | |
} |
let intArray = [0, 1, 2, 3, 4] | |
let mappedStrings = intArray.map { (number) -> String in | |
return "\(number)" | |
} | |
// ^ Result: ["0", "1", "2", "3", "4"] | |
let squared = intArray.map { (number) -> Int in | |
return number * number |
let mappedStrings = intArray.map { "\($0)" } | |
let squared = intArray.map { $0 * $0 } |
let mod = intArray.filter { $0 % 2 == 0 } |
let squaredMod = (1...10).map { $0 * $0 }.filter { $0 % 2 == 0 } |
var total = 0 | |
for num in intArray { | |
total = total + num | |
} | |
let totalByReduce = intArray.reduce(0) { total, num in total + num } | |
let totalByReduceShortHand = intArray.reduce(0, combine: { $0 + $1 }) | |
let shortReduce = intArray.reduce(0, combine: +) |
//Registration | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool | |
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in | |
// Enable or disable features based on authorization. | |
} | |
} | |
//UNAuthorizationOptions | |
public struct UNAuthorizationOptions : OptionSet { | |
public init(rawValue: UInt) | |
public static var badge: UNAuthorizationOptions { get } |
UNUserNotificationCenter.current().getNotificationSettings { (settings) in // ... } | |
open class UNNotificationSettings : NSObject, NSCopying, NSSecureCoding { | |
open var authorizationStatus: UNAuthorizationStatus { get } | |
open var soundSetting: UNNotificationSetting { get } | |
open var badgeSetting: UNNotificationSetting { get } | |
open var alertSetting: UNNotificationSetting { get } | |
open var notificationCenterSetting: UNNotificationSetting { get } | |
open var lockScreenSetting: UNNotificationSetting { get } | |
open var carPlaySetting: UNNotificationSetting { get } |