- 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 proposal introduces a with
function to the standard library. This function
// Here's what usage looks like: | |
class Person: ManagedObject { | |
// Note: Although the proposal shows `var [foo]`, current thinking is | |
// actually that we'll use `@foo var`. | |
@persistent var name: String | |
@persistent var birthDate: Date | |
@persistent var socialSecurityNumber: String? | |
@persistent var children: Set<Person> |
#!/Library/Developer/Toolchains/swift-LOCAL-2016-05-04-a.xctoolchain/usr/bin/swift | |
// | |
// codes2swift.swift | |
// WebResponderCore | |
// | |
// Created by Brent Royal-Gordon on 6/20/15. | |
// Copyright © 2015 Groundbreaking Software. All rights reserved. | |
// | |
import Foundation |
#!/Library/Developer/Toolchains/swift-LOCAL-2016-05-02-a.xctoolchain/usr/bin/swift | |
// Change the line above if your prototype Swift interpreter is installed somewhere else. | |
// The easiest way to run this on El Capitan is: | |
// $ perl /usr/bin/prove5.18 quotetest.swift --verbose | |
/// Test output generator. Skip down to the comment that says "BEGIN TESTS" for the good stuff. | |
class Plan { | |
enum Verbosity { | |
case Always, Unexpected, Never |
// Sequence of 1, 2, 4 ... 64 | |
induce(from: 1, to: 128, by: { $0 * 2 }) | |
induce(from: 1, to: 128, by: { $0 *= 2 }) | |
// Sequence of 1, 2, 4 ... 128 | |
induce(from: 1, through: 128, by: { $0 * 2 }) | |
induce(from: 1, through: 128, by: { $0 *= 2 }) | |
// Sequence of 1, 2, 4 ... with arbitrary, calculated bound | |
import Darwin |
import Foundation | |
extension NSCalendar { | |
public enum Interval { | |
case zero | |
case other(n: Int, calendar: NSCalendar, unit: NSCalendarUnit, options: NSCalendarOptions) | |
init(n: Int, calendar: NSCalendar, unit: NSCalendarUnit, options: NSCalendarOptions) { | |
if n == 0 { | |
self = .zero |
import Foundation | |
extension NSDate { | |
func unitView(unit: NSCalendarUnit, for calendar: NSCalendar = NSCalendar.currentCalendar(), options: NSCalendarOptions = [.MatchNextTimePreservingSmallerUnits]) -> UnitView { | |
return UnitView(calendar: calendar, date: self, unit: unit, options: options) | |
} | |
struct UnitView: Strideable, CustomStringConvertible { | |
let calendar: NSCalendar | |
let date: NSDate |
protocol InfiniteGeneratorType: GeneratorType { | |
mutating func next() -> Element | |
} | |
extension InfiniteGeneratorType { | |
mutating func next() -> Self.Element? { | |
return next() as Element | |
} | |
} |
newCacheNodeForManagedObject -> NSAtomicStoreCacheNode | |
cacheNodes -> Set | |
cacheNodeForObjectID -> NSAtomicStoreCacheNode? | |
objectIDForEntity -> NSManagedObjectID | |
newReferenceObjectForManagedObject -> AnyObject | |
referenceObjectForObjectID -> AnyObject | |
valueForKey -> AnyObject? | |
entityForName -> NSEntityDescription? | |
insertNewObjectForEntityForName -> NSManagedObject | |
relationshipsWithDestinationEntity -> [NSRelationshipDescription] |