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
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
UIImage *blurredImage = [[UIImage imageNamed:@"ball"] applyBlurWithRadius:1.5 | |
tintColor:nil | |
saturationDeltaFactor:1.0 | |
maskImage:nil]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
_ballImageView.image = blurredImage; |
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 MyClass { | |
var total: Int = 0 | |
lazy var myFunc: (x: Int, y: Int) -> Void = {(x: Int, y: Int) in | |
self.total = x + y | |
} | |
deinit { | |
print("deinit") |
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 SpriteKit | |
class GameScene: SKScene { | |
private var mainCircle: SKSpriteNode! | |
override func didMoveToView(view: SKView) { | |
physicsBody = SKPhysicsBody(edgeLoopFromRect: self.frame) | |
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
if let fileUTI = UTTypeCreatePreferredIdentifierForTag( | |
kUTTagClassFilenameExtension, fileName.pathExtension, nil) { | |
if UTTypeConformsTo(fileUTI.takeRetainedValue(), kUTTypePDF) != 0 { | |
NSLog("test") | |
} | |
} |
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 ViewController: UIPageViewController, UIPageViewControllerDataSource { | |
private let imageNameList: [String] = ["ball.png", "neko.png"] | |
private var index: Int = 0 | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
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 TestAPI: NSObject { | |
func call(url: NSURL, | |
success handleSuccess: ((NSDictionary) -> Void)?, | |
failure handleFailure: ((NSError) -> Void)?) { | |
let request = NSURLRequest(URL: url) | |
let session = NSURLSession.sharedSession() |
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 LogFormatter: DDDispatchQueueLogFormatter, DDLogFormatter { | |
let threadUnsafeDateFormatter: NSDateFormatter | |
override init() { | |
threadUnsafeDateFormatter = NSDateFormatter() | |
threadUnsafeDateFormatter.formatterBehavior = .Behavior10_4 | |
threadUnsafeDateFormatter.dateFormat = "HH:mm:ss.SSS" | |
super.init() |
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 PDFViewController: UIViewController, UIScrollViewDelegate { | |
@IBOutlet weak var scrollView: UIScrollView! | |
@IBOutlet weak var pageControl: UIPageControl! | |
private var imageList: [UIImage] = [] | |
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
let myView1 = UIView() | |
myView1.backgroundColor = UIColor.greenColor() | |
myView1.setTranslatesAutoresizingMaskIntoConstraints(false) | |
self.view.addSubview(myView1) | |
let myView2 = UIView() | |
myView2.backgroundColor = UIColor.orangeColor() | |
myView2.setTranslatesAutoresizingMaskIntoConstraints(false) | |
myView1.addSubview(myView2) | |