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 CloudKit | |
| /// async gets iCloud record ID object of logged-in iCloud user | |
| func iCloudUserIDAsync(complete: (instance: CKRecordID?, error: NSError?) -> ()) { | |
| let container = CKContainer.defaultContainer() | |
| container.fetchUserRecordIDWithCompletionHandler() { | |
| recordID, error in | |
| if error != nil { | |
| print(error!.localizedDescription) | |
| complete(instance: nil, error: error) |
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 CloudKit | |
| iCloudUserIDAsync() { | |
| recordID, error in | |
| if let userID = recordID?.recordName { | |
| print("received iCloudID \(userID)") | |
| } else { | |
| print("Fetched iCloudID was nil") | |
| } | |
| } |
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
| Build settings from command line: | |
| ONLY_ACTIVE_ARCH = NO | |
| SDKROOT = iphonesimulator9.2 | |
| === BUILD TARGET SwiftyBeaver (iOS) OF PROJECT SwiftyBeaver WITH CONFIGURATION Release === | |
| Check dependencies | |
| Write auxiliary files | |
| write-file /Users/sebastian/Library/Developer/Xcode/DerivedData/SwiftyBeaver-afdkbmzqyrmnmdcgjtcdgpqjjvcp/Build/Intermediates/SwiftyBeaver.build/all-product-headers.yaml |
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
| /// returns optional relative date interval string like "2d" | |
| /// depending on the unitsstyle, see docs at http://apple.co/1ox2sOX | |
| /// inject an existing NSDateComponentsFormatter() for performance | |
| func relativeDateInterval(date: NSDate, | |
| unitsStyle: NSDateComponentsFormatterUnitsStyle, | |
| formatter: NSDateComponentsFormatter) -> String? { | |
| // inspired by top answer at http://bit.ly/1TzMQqV | |
| let formatter = NSDateComponentsFormatter() | |
| formatter.unitsStyle = unitsStyle //.Abbreviated, .Full, ... | |
| formatter.includesApproximationPhrase = false |
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
| // sends SwiftyBeaver logs to a file in your app’s document directory | |
| // instead of the default caches directory | |
| // learn more about SwiftyBeaver at https://github.com/SwiftyBeaver/SwiftyBeaver | |
| let fm = NSFileManager.defaultManager() | |
| if let docsURL = fm.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first { | |
| let file = FileDestination() | |
| file.logFileURL = docsURL.URLByAppendingPathComponent("my.log") | |
| log.addDestination(file) | |
| log.info("writing logs to \(file.logFileURL)") |
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
| mkdir MyProject | |
| cd MyProject | |
| swift package init --type executable | |
| # will create the following output | |
| > Creating executable package: MyProject | |
| > Creating Package.swift | |
| > Creating .gitignore | |
| > Creating Sources/ | |
| > Creating Sources/main.swift |
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 PackageDescription | |
| let package = Package( | |
| name: "MyProject", | |
| targets: [], | |
| dependencies: [ | |
| .Package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver.git", | |
| majorVersion: 1, minor: 0) | |
| ] | |
| ) |
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
| swift package update | |
| > Cloning https://github.com/SwiftyBeaver/SwiftyBeaver.git | |
| > HEAD is now at 83a0dd4 colored Emojis for native Xcode 8 Console support | |
| > Resolved version: 1.0.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
| swift package generate-xcodeproj | |
| > generated: ./MyProject.xcodeproj |
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
| swift build --clean |