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
// | |
// ViewController.swift | |
// flamingpants-firebase-tutorial | |
// | |
// Created by Daniel Williams on 5/29/16. | |
// Copyright © 2016 Dandom, LLC. All rights reserved. | |
// | |
import UIKit | |
import Firebase |
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
// | |
// ViewController.swift | |
// YogiDoListFB | |
// | |
// Created by Daniel Williams on 6/16/16. | |
// Copyright © 2016 Dandom, LLC. All rights reserved. | |
// | |
import UIKit | |
import FirebaseAuth |
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
class TransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate { | |
var openingFrame: CGRect? | |
func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? { | |
let presentationAnimator = PresentationAnimator() | |
presentationAnimator.openingFrame = openingFrame! | |
return presentationAnimator | |
} | |
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
class TransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate { | |
var openingFrame: CGRect? | |
func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? { | |
let presentationAnimator = PresentationAnimator() | |
presentationAnimator.openingFrame = openingFrame! | |
return presentationAnimator | |
} | |
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
PHImageManager().requestAVAsset(forVideo: asset, options: options, resultHandler: { (avAsset, mix, info) in | |
guard let avAsset = avAsset else { return } | |
for track in avAsset.tracks(withMediaType: AVMediaTypeVideo) { | |
for segment in track.segments { | |
dump(segment) | |
} | |
} | |
}) |
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
<AVCompositionTrackSegment: 0x1700da400 timeRange [0.000,+0.943] from trackID 1 of asset file:///var/mobile/Media/DCIM/101APPLE/IMG_1997.MOV sourceTimeRange [0.000,+0.943]> #0 | |
<AVCompositionTrackSegment: 0x1700d3ef0 timeRange [0.943,+0.015] from trackID 1 of asset file:///var/mobile/Media/DCIM/101APPLE/IMG_1997.MOV sourceTimeRange [0.943,+0.013]> #0 | |
<AVCompositionTrackSegment: 0x1700dbdd0 timeRange [0.958,+0.045] from trackID 1 of asset file:///var/mobile/Media/DCIM/101APPLE/IMG_1997.MOV sourceTimeRange [0.957,+0.033]> #0 | |
<AVCompositionTrackSegment: 0x1700dc7e0 timeRange [1.003,+0.083] from trackID 1 of asset file:///var/mobile/Media/DCIM/101APPLE/IMG_1997.MOV sourceTimeRange [0.990,+0.048]> #0 | |
<AVCompositionTrackSegment: 0x1700d9670 timeRange [1.087,+0.130] from trackID 1 of asset file:///var/mobile/Media/DCIM/101APPLE/IMG_1997.MOV sourceTimeRange [1.038,+0.055]> #0 | |
<AVCompositionTrackSegment: 0x1700db350 timeRange [1.217,+0.182] from trackID 1 of asset file:///var/mobile/Media/DCIM/101APPLE/IMG_1997.MOV sou |
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
let fullRange = CMTimeRange(start: kCMTimeZero, duration: CMTime(value: 30, timescale: 1)) | |
let emptyComposition = AVMutableComposition() | |
let track = emptyComposition.addMutableTrack(withMediaType: AVMediaTypeVideo, preferredTrackID: 1) | |
let initialSegment = AVCompositionTrackSegment(url: sourceURL, trackID: 1, sourceTimeRange: fullRange, targetTimeRange: fullRange) | |
track.segments = [initialSegment] |
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
let firstHalf = CMTimeRange(start: kCMTimeZero, duration: CMTime(value: 15, timescale: 1)) | |
track.scaleTimeRange(firstHalf, toDuration: fullRange.duration) |
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
protocol Foo { | |
func bar() | |
} | |
extension Foo { | |
func bar() { | |
print("Foo.bar()") | |
} | |
} |
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 Foo where Self: SomeFoo { | |
func bar() { | |
print("Foo.SomeFoo.bar()") | |
} | |
} | |
let someFoo: SomeFoo = SomeFoo() | |
someFoo.bar() // Foo.SomeFoo.bar() | |
let anotherFoo: Foo = SomeFoo() |
OlderNewer