@@ -42,12 +42,12 @@ ViewAnimation(duration: 0.5) {
4242Whereas using UIKit + Core Animation you'd have to do something like this:
4343
4444``` swift
45- UIView.animateWithDuration ( 0.5 ) {
45+ UIView.animate ( withDuration : 0.5 ) {
4646 v.center = self .view .center
4747}
4848
4949CATransaction.begin ()
50- CATransaction.setValue (NSNumber ( float : 0.5 ) , forKey : kCATransactionAnimationDuration)
50+ CATransaction.setValue (0.5 , forKey : kCATransactionAnimationDuration)
5151if let shapeLayer = v.layer as? CAShapeLayer {
5252 shapeLayer.lineWidth = 5
5353}
@@ -122,18 +122,18 @@ Using UIKit + AVFoundation, you'd have to construct the movie object from scratc
122122
123123``` swift
124124func viewDidLoad () {
125- guard let url = NSBundle. mainBundle (). URLForResource ( " halo.mp4" , withExtension : nil ) else {
125+ guard let url = Bundle.main. url ( forResource : " halo.mp4" , withExtension : nil ) else {
126126 fatalError (" File not found" )
127127 }
128128
129- let asset = AVAsset (URL : url)
129+ let asset = AVAsset (url : url)
130130 let player = AVQueuePlayer (playerItem : AVPlayerItem (asset : asset))
131- player.actionAtItemEnd = .Pause
131+ player.actionAtItemEnd = .pause
132132
133133 let movieLayer = AVPlayerLayer (player : player)
134- movieLayer.videoGravity = AVLayerVideoGravityResize
134+ movieLayer.videoGravity = . resize
135135
136- let tracks = asset.tracksWithMediaType (AVMediaTypeVideo )
136+ let tracks = asset.tracks ( withMediaType : . video )
137137
138138 let movieTrack = tracks[0 ]
139139 let size = movieTrack.naturalSize
0 commit comments