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
func asyncTestWithAssertBlock(block: (XCTestExpectation)->()) { | |
let expectation = self.expectationWithDescription("test expectation") | |
block(expectation) | |
waitForExpectationsWithTimeout(3, handler: nil) | |
} | |
func notifTestWithAssertBlock(block: ()-> Void) { | |
expectationForNotification(Blurbs.BlurbsReadyNotification, object: nil) { _ in | |
block() | |
return 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
extension UIStoryboard { | |
static func main() -> UIStoryboard { | |
return UIStoryboard(name: "Main", bundle: nil) | |
} | |
// assuming that name of the class is the identifier | |
static func controllerOfType<C where C : UIViewController> (type : C.Type) -> C { | |
let name = String(type) | |
let vc = UIStoryboard.main().instantiateViewControllerWithIdentifier(name) |
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
# UIPresentation Controlers | |
https://realm.io/news/slug-jesse-squires-swifty-view-controller-presenters/ | |
Transition > transiting state | |
Presentation > final state | |
Presentation hook into the transition API | |
responsibilities |
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
#file in first sub directory | |
find . -iname "*.strings" -maxdepth 2 | |
#file with pattern | |
ls -d *.lproj | |
#file with pattern recurive | |
find . *.lproj -type d -print | |
#directory of file |
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
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist | |
– Delete current line: ctrl + shift + k | |
– Duplicate current line: ctrl + shift + c | |
– Insert line below: ctrl + o | |
– Insert line above: ctrl + shift + o | |
#Insertion and indentation | |
<key>Insert New Line Below</key> |
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
ps aux | grep myprocessname | cut -d " " -f 2 | xargs kill |
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 Dictionary where Key: StringLiteralConvertible, Value: AnyObject { | |
var jsonString: String { | |
return "" | |
} | |
} |
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
protocol StringValueExpressible { | |
var stringValue: String { get } | |
} | |
extension String : StringValueExpressible { | |
var stringValue: String { | |
get { return 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
grep -r Answers . --include=\*.{m,swift} | |
#remove filename | |
grep -r Answers . --include=\*.{m,swift} -h | |
#remove white spaces | |
grep -r Answers . --include=\*.{m,swift} -h | sed -e 's/^[ \t]*//' |
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
enum SvcError: ErrorType { | |
case Bla | |
case Blo | |
case Code(Int) | |
} | |
let e: ErrorType = SvcError.Code(3) | |
OlderNewer