One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| #!/usr/bin/env swift | |
| import Foundation | |
| let args = Process.arguments | |
| if (args.count != 2) { | |
| print("usage: \(args[0].lastPathComponent) <file>\n") | |
| exit(-1) | |
| } |
| #!/usr/bin/env swift | |
| import Foundation | |
| let args = Process.arguments | |
| if (args.count != 2) { | |
| print("usage: \(args[0]) <file>\n") | |
| exit(-1) | |
| } |
| import UIKit | |
| /// A very simple example view that can accept keyboard input and add or delete text from an enclosed label. | |
| class CustomTextInputView : UIControl, UIKeyInput { | |
| var label : UILabel? | |
| override func canBecomeFirstResponder() -> Bool { | |
| return true | |
| } |
| protocol Initializable { | |
| init() | |
| } | |
| class A : Initializable { | |
| var content:String | |
| required init() { | |
| content = "TestContent" | |
| } |
| // #!Swift-1.1 | |
| import Foundation | |
| // MARK: - (1) classes | |
| // Solution 1: | |
| // - Use classes instead of struct | |
| // Issue: Violate the concept of moving model to the value layer | |
| // http://realm.io/news/andy-matuschak-controlling-complexity/ |
| // | |
| // DetailViewController.swift | |
| // TransitionCoordinator | |
| // | |
| // Created by Rob Nadin on 15/02/2015. | |
| // Copyright (c) 2015 Rob Nadin. All rights reserved. | |
| // | |
| import UIKit |
| extension UIImage { | |
| public func imageRotatedByDegrees(degrees: CGFloat) -> UIImage { | |
| let radiansToDegrees: (CGFloat) -> CGFloat = { | |
| return $0 * (180.0 / CGFloat(M_PI)) | |
| } | |
| let degreesToRadians: (CGFloat) -> CGFloat = { | |
| return $0 / (180.0 * CGFloat(M_PI)) | |
| } | |
| // calculate the size of the rotated view's containing box for our drawing space |
| // Requires macros: | |
| #define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI)) | |
| #define DEGREES_TO_RADIANS(angle) (angle / 180.0 * M_PI) | |
| - (UIImage *)imageRotatedByDegrees:(CGFloat)degrees | |
| { | |
| // calculate the size of the rotated view's containing box for our drawing space | |
| UIView *rotatedViewBox = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.size.width, self.size.height)]; | |
| CGAffineTransform t = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(degrees)); |
| osascript -e 'tell application "iOS Simulator" to quit' | |
| osascript -e 'tell application "Simulator" to quit' | |
| xcrun simctl erase all |