- Proposal: SE-NNNN
- Authors: Becca Royal-Gordon
- Review Manager: TBD
- Status: Awaiting implementation (but only of resilience support)
- Implementation: In main and release/6.0, behind the
ObjCImplementationexperimental feature flag - Upcoming Feature Flag:
ObjCImplementation
This file contains hidden or 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
| let color = "blue" | |
| let num = 42 | |
| localized("Colorless green ideas sleep furiously.") | |
| localized("Colorless \(color) ideas sleep furiously.") | |
| localized("\(num.formatted("%05d")) colorless green ideas sleep furiously.") |
- Proposal: SE-NNNN
- Authors: Becca Royal-Gordon, Varun Gandhi
- Review Manager: TBD
- Implementation: In master behind
-Xfrontend -enable-cross-import-overlays - Status: Prototyped behind a feature flag
This file contains hidden or 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
| // Note that I have never run this code; it may have bugs or even be syntactically invalid. | |
| - (NSAttributedString*)attributedTextForPost:(ANPost*)post { | |
| NSMutableAttributedString * attributedText = [[NSMutableAttributedString alloc] initWithString:post.text]; | |
| for(ANEntity * entity in post.entities.all) { | |
| [attributedText setAttributes:@{ | |
| NSForegroundColorAttributeName: [UIColor blueColor], | |
| NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle), | |
| @"entity": entity |
This file contains hidden or 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
| // | |
| // UserDefaults+Codable.swift | |
| // Converter UltraLight | |
| // | |
| // Created by Brent Royal-Gordon on 8/31/17. | |
| // Copyright © 2017 Architechies. All rights reserved. | |
| // MIT-licensed, go nuts with it. | |
| // | |
| import Foundation |
This file contains hidden or 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
| // First, let's test out the basic design. This is basically just an | |
| // HList. | |
| // This recurses to the right because that makes subscripting simpler, | |
| // at the cost of making appending impossible to generalize. | |
| public protocol TupleProtocol: RandomAccessCollection | |
| where Index == Int, IndexDistance == Int, Element == Any | |
| { | |
| associatedtype First | |
| associatedtype Rest //: TupleProtocol |
This file contains hidden or 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
| #!/usr/bin/xcrun swift | |
| import Dispatch | |
| import Cocoa | |
| dispatch_async(dispatch_get_main_queue()) { | |
| let URLsToRecycle = Array(dropFirst(Process.arguments)).map { NSURL(fileURLWithPath: $0) } | |
| NSWorkspace.sharedWorkspace().recycleURLs(URLsToRecycle) { dict, error in | |
| let recycledURLs = Array(dict.keys) as [NSURL] |
This file contains hidden or 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
| let array = Array(1...10) | |
| array[.startIndex ..< 3] | |
| array[.startIndex + 2 ..< .endIndex - 1] |
This file contains hidden or 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
| // Playground - noun: a place where people can play | |
| import Foundation | |
| protocol XMLChild { | |
| var XMLNode: NSXMLNode { get } | |
| } | |
| extension String: XMLChild { | |
| var XMLNode: NSXMLNode { |
This file contains hidden or 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
| import Foundation | |
| public protocol LocalizableArgument { | |
| var localizableFormat: String { get } | |
| var localizableFormatArguments: [CVarArg] { get } | |
| } | |
| extension LocalizableArgument where Self: CVarArg { | |
| public var localizableFormatArguments: [CVarArg] { | |
| return [self] |
NewerOlder