- Day 1
- Oh yeah you can use
_
as a number separator in Int's - Some easy getting started stuff about
var
vs.let
Double
Int
Bool
String
and multi line string declarations - You can use mulit line string even when you dont want mulit line output by escaping the newlines.
- Oh yeah you can use
- Day 2
- Tuples are fixed in size and fixed in type once you create them
let tup = ("one", 1)
will always be of type(String, Int)
you can not change the type of either of the items or add more to the beginning or end.
- Tuples are fixed in size and fixed in type once you create them
- Syntax for adding a default when doing a dictionary lookup
let value = mydict["key", default: 3]
wonder why this syntax exists? How is it different fromlet value = mydict["missing_key"] ?? 3
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 UIKit | |
private func delegateClassName() -> String? { | |
guard NSClassFromString("TestBundleName.TestingAppDelegate") == nil else { | |
// when running fast tests, use a nil AppDelegate | |
return nil | |
} | |
return NSStringFromClass(AppDelegate.self) | |
} |
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
+#if DEBUG | |
+extension UIView { | |
+ @available(*, deprecated, message: "This warning is here so you don't ship this code") | |
+ @objc func exerciseAmbiguityInLayoutRepeatedly() { | |
+ if self.hasAmbiguousLayout { | |
+ Timer.scheduledTimer(timeInterval: 0.5, | |
+ target: self, | |
+ selector: #selector(UIView.exerciseAmbiguityInLayout), | |
+ userInfo: nil, | |
+ repeats: true) |
- Email Inbox
- Personal Calendar
- Work Calendar
- Slack
- Github PR's waiting for my review
- Github PR's I have awaiting Review
- Other github messages and checkup
- Currently open Safari Tabs.
- Omnifocus Review Tab
- Work through Omnifocus Inbox
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 test 2>&1 | xcpretty -t | |
# Thanks to Keith Smiley | |
# https://twitter.com/SmileyKeith/status/949865525374418944 |
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
class LoadingVC: UIViewController { | |
lazy var loadingIndicator: UIActivityIndicatorView = { | |
let loading = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray) | |
return loading | |
}() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.backgroundColor = .white |
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
extension UIView { | |
func exerciseAmbiguityInLayoutRepeatedly(_ recursive: Bool) { | |
#if DEBUG | |
if hasAmbiguousLayout { | |
Timer.scheduledTimer(timeInterval: 0.5, | |
target: self, | |
selector: #selector(exerciseAmbiguityInLayout), | |
userInfo: nil, | |
repeats: true) | |
} |
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
// (Int, Int) -> Int | |
func add(num1: Int, num2: Int) -> Int { | |
return num1 + num2 | |
} | |
// increment just adds to any other number | |
let curried: (Int) -> ((Int) -> Int) = { num in | |
return { num2 in | |
return add(num1: num, num2: num2) | |
} |
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 UIKit | |
class PossibleView: UIView { | |
let header: UILabel = { | |
let label = UILabel(frame: .zero) | |
label.translatesAutoresizingMaskIntoConstraints = false | |
label.backgroundColor = .brown | |
label.numberOfLines = 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
{ | |
"header": { | |
"Name": "MDErgo1", | |
"Layout": "Default", | |
"Base": "Blank", | |
"Version": "0.1", | |
"Author": "HaaTa (Jacob Alexander) 2015", | |
"KLL": "0.3c", | |
"Date": "2015-09-12", | |
"Generator": "KIICONF 0.2" |
NewerOlder