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 SingleTapTextView: UITextView { | |
| required init?(coder aDecoder: NSCoder) { | |
| super.init(coder: aDecoder) | |
| setup() | |
| } | |
| override init(frame: CGRect, textContainer: NSTextContainer?) { | |
| super.init(frame: frame, textContainer: textContainer) | |
| setup() | |
| } |
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
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate { | |
| // ... | |
| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
| // ... | |
| let tap = UITapGestureRecognizer(target: self, action: #selector(AppDelegate.tap(_:))) | |
| window?.addGestureRecognizer(tap) | |
| tap.delegate = self | |
| tap.cancelsTouchesInView = false | |
| // ... |
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 Router: URLRequestConvertible { | |
| static let baseURL = NSURL(string: "https://littlebitesofcocoa.com")! | |
| case Bites | |
| case Bite(Int) | |
| case BitesTagged(Int) | |
| var URL: NSURL { return Router.baseURL.URLByAppendingPathComponent(route.path) } | |
| var route: (path: String, parameters: [String : AnyObject]?) { |
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 UITextField { | |
| var isEmpty: Bool { | |
| guard let text = text else { return true } | |
| return text.isEmpty | |
| } | |
| } |
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 | |
| extension UIViewController { | |
| func presentFromRight(controller: UIViewController) { | |
| let transition: CATransition = CATransition() | |
| transition.duration = 0.35 | |
| transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) | |
| transition.type = kCATransitionMoveIn | |
| transition.subtype = kCATransitionFromRight | |
| guard let containerView = view.window else { 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
| TAGS="TODO:|FIXME:|WARNING:|FIXME" | |
| echo "searching ${SRCROOT} for ${TAGS}" | |
| find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
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 UILabel { | |
| var animatedText: String { | |
| set { | |
| let animation = CATransition() | |
| animation.duration = 0.3 | |
| animation.type = kCATransitionFade | |
| animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) | |
| layer.addAnimation(animation, forKey: "changeTextTransition") | |
| text = newValue |
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 InterpolatedPath { | |
| enum InterpolationType { | |
| case Hermite | |
| case CatmullRom | |
| case BezierSpline | |
| } | |
| private (set) var closed: Bool |
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
| // | |
| // Animator.swift | |
| // | |
| // Created by Mateusz Nogaj on 26/03/16. | |
| // | |
| import UIKit | |
| public func==(lhs: Animation, rhs: Animation) -> Bool { | |
| return (lhs.name == rhs.name) && (lhs.view === rhs.view) |
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 RadialGradient:CALayer { | |
| var startColor:UIColor! | |
| var endColor:UIColor! | |
| override init() { | |
| super.init() | |
| setNeedsDisplay() | |
| } | |
| required init?(coder aDecoder: NSCoder) { |