INNER CODE UNIT · Swift

viewWillTransition

wu9007/qrcode_scanner · ios/Classes/SwiftQrscanPlugin.swift:321

  override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)
    coordinator.animate(alongsideTransition: { _ in
      self.previewLayer?.frame = CGRect(origin: .zero, size: size)
      self.overlay.frame = CGRect(origin: .zero, size: size)
      self.overlay.setNeedsLayout()
      self.updateVideoOrientation()
    })
  }

  private func configureSession() {
    session.beginConfiguration()
    session.sessionPreset = .high
    guard let device = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) else {
      session.commitConfiguration()
      DispatchQueue.main.async { [weak self] in
        self?.complete(nil, error: "CAMERA_START_FAILED")
      }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…