- A value of class type in Swift is never nil
var fileModificationDate: NSDate!
- Objective-C does not have a notion of a "never-nil" pointer
!
is an implicitly unwrapped optional- can be tested explicitly for nil
- can directly access properties/methods of the underlying value
- can be implicitly converted to its underlying value
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
/// Find the index of the first element of a sequence that satisfies a predicate | |
/// | |
/// :param: sequence A sequence to be searched | |
/// :param: predicate A function applied to each element in turn until it returns true | |
/// | |
/// :returns: Zero-based index of first element that satisfies the predicate, or nil if no such element was found | |
public func findIndex<S: SequenceType>(sequence: S, predicate: (S.Generator.Element) -> Bool) -> Int? { | |
for (index, element) in enumerate(sequence) { | |
if predicate(element) { | |
return index |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
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
// | |
// UIImage+vImageScaling.h | |
// UIImage+vImageScaling | |
// | |
// Created by Matt Donnelly on 03/07/2013. | |
// Copyright (c) 2013 Matt Donnelly. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
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
UI- and App Frameworks Evangelist - Jake Behrens, [email protected], twitter: @Behrens | |
- What's new in Cocoa | |
- Accessibility in iOS | |
- Building User Interfaces for iOS 7 | |
- Getting Started with UIKit Dynamics | |
- What's new in Cocoa Touch | |
- What's New With Multitasking | |
- Best Practices for Cocoa Animation | |
- Improving Power Efficiency with App Nap | |
- Introducing Text Kit |
NewerOlder