- Do not pass
true
toUIView.snapshotView(afterScreenUpdates:)
when create a snapshot for animated transition object (false
is fine). - Don't call
animator.startAnimation()
oranimator.pauseAnimator()
instartInteractiveTransition(_:)
- If
interruptibleAnimator(using:)
is implemented,UINavigationController
will observefractionComplete
from the returned animator object (not confirmed but very likely) and will animate the navigation bar accordingly to that value. CallingUIViewControllerContextTransitioning.updateInteractiveTransition(_:)
will almost have no effect on the navigation bar animation (but you should call it anyway). - If
interruptibleAnimator(using:)
is not implemented,UINavigationController
will use values that are passed toUIViewControllerContextTransitioning.updateInteractiveTransition(_:)
to animate the navigation bar.
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 | |
import PlaygroundSupport | |
class QRCodeView: UIView { | |
lazy var filter = CIFilter(name: "CIQRCodeGenerator") | |
lazy var imageView = UIImageView() | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
addSubview(imageView) |
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
// | |
// CameraController.swift | |
// | |
import AVFoundation | |
import Photos | |
import UIKit | |
class CameraController: UIViewController { | |
enum Camera { |
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 | |
import AVFoundation | |
class ViewController: UIViewController { | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) | |
switch AVCaptureDevice.authorizationStatus(for: .video) { | |
case .notDetermined: |
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 XCTest | |
final class Static { | |
func a() { 1 + 1 } | |
func b() { a() } | |
func c() { b() } | |
} | |
class Dynamic { | |
func a() { 1 + 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
import XCTest | |
class MyTestCase: XCTestCase { | |
func testExample() { | |
measure { | |
// Code to measure | |
} | |
} | |
} |
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 RxSwift | |
/// | |
/// The operators can be generated by running the below code with Swift 4 | |
/// | |
// | |
//let methodCount = 6 | |
// | |
//print(""" | |
//extension ObservableType { |
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
//: A UIKit based Playground to present user interface | |
import UIKit | |
import Vision | |
import PlaygroundSupport | |
class ViewController : UIViewController { | |
let imageView = UIImageView() | |
let overlayImageView = UIImageView() |
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 | |
struct Point { | |
let x: Double | |
let y: Double | |
} | |
extension Point { | |
static let zero = Point(x: 0, y: 0) |
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
// Protocols | |
protocol Serializable { | |
func serialized() -> String | |
} | |
protocol Field: Serializable { | |
// ... | |
} |