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
root = true | |
[*.swift] | |
indent_style = space | |
indent_size = 2 | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
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
{ | |
"keymap": [ | |
{ | |
"keyCode": 52, | |
"label": "'" | |
}, | |
{ | |
"keyCode": 54, | |
"label": "," | |
}, |
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
// I needed to fetch all the pages from a paged endpoint. | |
// In this specific case, the JSON results contained a `pagingStatus` section that provided extra information which I could use: | |
// Hiding that behind a protocol: | |
import Foundation | |
protocol PagedReturning { | |
var pagingStatus: PagingStatus { get } | |
} |
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
import Foundation | |
import PlaygroundSupport | |
import SwiftUI | |
struct Content: View { | |
var body: some View { | |
Text("👋🏻, 🌍!") | |
} | |
} |
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
// Scanner+Swift.swift | |
// | |
// A set of idiomatic swift extensions to Scanner | |
// | |
// Based on https://gist.github.com/natecook1000/59bb0c9117b555f5d40d | |
// Converted to Swift 3 | |
// | |
import Foundation |
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
import Foundation | |
/// abstract: Convenience methods for getting standard URLs | |
extension NSURL { | |
/// The URL to the Documents directory | |
static var documentsURL: NSURL { | |
return try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: true) | |
} |
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
github "jspahrsummers/xcconfigs" | |
github "JungleCandy/LoggingPrint" |
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
//: Playground - noun: a place where people can play | |
import Foundation | |
import XCPlayground | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
// Extend NSTimeInterval to provide the conversion functions. | |
extension NSTimeInterval { |
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
// | |
// RepeatingTimer.swift | |
// | |
import Foundation | |
enum TimerError: ErrorType { | |
/// The timer could not be created. | |
case CouldNotCreate | |
} |
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
var formatter: NSNumberFormatter = { | |
let f = NSNumberFormatter() | |
f.locale = NSLocale.currentLocale() | |
f.maximumFractionDigits = 2 | |
f.minimumFractionDigits = 2 | |
f.alwaysShowsDecimalSeparator = true | |
f.numberStyle = .CurrencyStyle | |
return f | |
}() |
NewerOlder