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
// ©2015 Massimiliano Raber, MIT license | |
// @IBDesignable/@IBInspectable GradientView (linear gradient, 2 stops) | |
import UIKit | |
@IBDesignable | |
class GradientView: UIView { | |
@IBInspectable var startColor: UIColor = UIColor.whiteColor() { | |
didSet { |
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
extension NSTimer { | |
/** | |
Creates and schedules a one-time `NSTimer` instance. | |
- Parameters: | |
- delay: The delay before execution. | |
- handler: A closure to execute after `delay`. | |
- Returns: The newly-created `NSTimer` instance. | |
*/ |
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
/*** | |
* | |
* Usage: | |
* ``` | |
* - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | |
* { | |
* [segue prepareWithExampleModel:self.model]; | |
* } | |
* ``` | |
*/ |
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 UIKit | |
import QuartzCore | |
@IBDesignable | |
public class CirclePhotoView: UIView { | |
@IBInspectable public var image: UIImage? |
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
// Gets the path to the app's Documents folder | |
- (NSString *)documentsDirectory | |
{ | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
return paths[0]; | |
} | |
// Gets the path to the data file | |
- (NSString *)dataFilePath | |
{ |