- Proposal: SE-0200
- Author: John Holdsworth, Brent Royal-Gordon, Erica Sadun
- Review Manager: Doug Gregor
- Status: Returned for revision
- Implementation: apple/swift#13055
- Bugs: SR-6362 Needs Update for New Design
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(""" | |
<?xml version="1.0"?> | |
<catalog> | |
\(bookTuples.map(xmlForBookTuple).joined(separator: "") | |
)</catalog> | |
""") | |
typealias ChapterTuple = (heading: String) | |
typealias BookTuple = (id: String, author: String, title: String, genre: String, price: String, chapters: [ChapterTuple]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Evaluates the given closure when two `Optional` instances are not `nil`, | |
// passing the unwrapped values as parameters. (Thanks, Mike Ash, Tim Vermeulen) | |
// Following the example of IEEE754 with NAN, any comparison involving | |
// .None is false | |
// | |
// See also: http://stackoverflow.com/questions/1565164/what-is-the-rationale-for-all-comparisons-returning-false-for-ieee754-nan-values | |
/// Returns nil if either parameter is nil, or a tuple of the parameters | |
/// otherwise. | |
func all<T, U>(_ first: T?, _ second: U?) -> (T, U)? { |
- Proposal: TBD
- Author: Brent Royal-Gordon
- Status: TBD
- Review manager: TBD
This proposal enhances optional binding with a new, tuple-based syntax for
- Proposal: TBD
- Author: Erica Sadun, Brent Royal-Gordon
- Status: TBD
- Review manager: TBD
This proposal introduces a with
function to the standard library. This function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct Distance :NumericType { | |
public var value :Double | |
public init(_ value: Double) { | |
self.value = value | |
} | |
} | |
extension Distance :IntegerLiteralConvertible { | |
public init(integerLiteral: IntegerLiteralType) { | |
self.init(Double(integerLiteral)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func split(separator:String) -> [String] { | |
return self.componentsSeparatedByString(separator) | |
} | |
} | |
extension Array { | |
func unpack() -> (T)? { | |
return count == 1 ? (self[0]) : nil | |
} |