damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

CameraService+Extensions.swift (870B)


      1 //
      2 //  CameraService+Extensions.swift
      3 //  damus
      4 //
      5 //  Created by Suhail Saqan on 8/5/23.
      6 //
      7 
      8 import Foundation
      9 import UIKit
     10 import AVFoundation
     11 
     12 extension AVCaptureVideoOrientation {
     13     init?(deviceOrientation: UIDeviceOrientation) {
     14         switch deviceOrientation {
     15         case .portrait: self = .portrait
     16         case .portraitUpsideDown: self = .portraitUpsideDown
     17         case .landscapeLeft: self = .landscapeRight
     18         case .landscapeRight: self = .landscapeLeft
     19         default: return nil
     20         }
     21     }
     22 
     23     init?(interfaceOrientation: UIInterfaceOrientation) {
     24         switch interfaceOrientation {
     25         case .portrait: self = .portrait
     26         case .portraitUpsideDown: self = .portraitUpsideDown
     27         case .landscapeLeft: self = .landscapeLeft
     28         case .landscapeRight: self = .landscapeRight
     29         default: return nil
     30         }
     31     }
     32 }