- Proposal: SE-XXXX
- Author: African Swift
- Status: Draft
- Review manager:
Support default values for enum associated values.
Support default values for enum associated values.
// The below code segment is an extraction from a compression routine for Ansi (ECMA 48) tags | |
// For example: | |
// All Ps functions are compressed through summation of Ps values, for example: | |
// \u{1b}[1C\u{1b}[3C\u{1b}[1B\u{1b}[1B\u{1b}[1B = \u{1b}[4C\u{1b}[3B | |
// All CSI Pm functions are compressed with a semicolon delimiting sub Pm values, for example: | |
// \u{1b}[1m\u{1b}[30m\u{1b}[45m = \u{1b}[1;30;45m | |
let tagArray = self.toString().characters.split( | |
isSeparator: { String($0) == Ansi.C0.ESC } ).map { Ansi.C0.ESC + String($0) } |
/* | |
Behaviour below is consistent with inline declaration, | |
index correctly mutates each interation | |
*/ | |
for var index = 0; index < 10; index += 1 { | |
index += 2 //mutable index | |
print(index, terminator: " ") // output = 2 5 8 11 | |
} | |
print("") |
private func handleNotificationAction(id: String?, userInfo: [NSObject: AnyObject], responseInfo: [NSObject: AnyObject]?, completion: () -> Void) { | |
// inline our id choices | |
enum idOptions: String { | |
case comment, invitation_accept, invitation_decline, star, complete, show, delegate, none | |
static var project: [idOptions] = [.invitation_accept, .invitation_decline] | |
static var task: [idOptions] = [.star, .complete] | |
} | |
// Unwrap optionals |