├── README.md ├── WithCamera ├── Assets.xcassets │ ├── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── AppDelegate.swift ├── PreviewItem.swift ├── WithCamera.entitlements ├── Document.swift ├── DragDropView.swift ├── Info.plist ├── ResizableView.swift ├── ViewController.swift └── Base.lproj │ └── Main.storyboard ├── WithCamera.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── project.pbxproj ├── LICENSE └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # WithCamera -------------------------------------------------------------------------------- /WithCamera/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /WithCamera/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | @NSApplicationMain 4 | class AppDelegate: NSObject, NSApplicationDelegate {} 5 | -------------------------------------------------------------------------------- /WithCamera.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WithCamera.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WithCamera/PreviewItem.swift: -------------------------------------------------------------------------------- 1 | import Quartz.QuickLookUI 2 | 3 | final class PreviewItem: NSObject, QLPreviewItem { 4 | var previewItemURL: URL 5 | var previewItemTitle: String 6 | 7 | init(url: URL, title: String? = nil) { 8 | self.previewItemURL = url 9 | self.previewItemTitle = title ?? url.lastPathComponent 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /WithCamera/WithCamera.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.device.camera 8 | 9 | com.apple.security.files.user-selected.read-only 10 | 11 | com.apple.security.network.client 12 | 13 | com.apple.security.network.server 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /WithCamera/Document.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | class Document: NSDocument { 4 | override init() { 5 | super.init() 6 | } 7 | 8 | override class var autosavesInPlace: Bool { 9 | return true 10 | } 11 | 12 | override func makeWindowControllers() { 13 | let storyboard = NSStoryboard(name: "Main", bundle: nil) 14 | let windowController = storyboard.instantiateController(withIdentifier: "Document Window Controller") as! NSWindowController 15 | self.addWindowController(windowController) 16 | } 17 | 18 | override func data(ofType typeName: String) throws -> Data { 19 | throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil) 20 | } 21 | 22 | override func read(from data: Data, ofType typeName: String) throws { 23 | throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /WithCamera/DragDropView.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | final class DragDropView: NSView { 4 | var onDrop: (URL) -> Void = { _ in } 5 | 6 | override init(frame frameRect: NSRect) { 7 | super.init(frame: frameRect) 8 | commonInit() 9 | } 10 | 11 | required init?(coder: NSCoder) { 12 | super.init(coder: coder) 13 | commonInit() 14 | } 15 | 16 | private func commonInit() { 17 | registerForDraggedTypes([.URL, .fileURL]) 18 | } 19 | 20 | override func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation { 21 | return .copy 22 | } 23 | 24 | override func performDragOperation(_ sender: NSDraggingInfo) -> Bool { 25 | guard let pasteboard = sender.draggingPasteboard.propertyList(forType: NSPasteboard.PasteboardType(rawValue: "NSFilenamesPboardType")) as? NSArray, 26 | let path = pasteboard[0] as? String else { return false } 27 | 28 | onDrop(URL(fileURLWithPath: path)) 29 | 30 | return true 31 | } 32 | 33 | override func hitTest(_ point: NSPoint) -> NSView? { 34 | return nil 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Kishikawa Katsumi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /WithCamera/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /WithCamera/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeExtensions 11 | 12 | mydoc 13 | 14 | CFBundleTypeIconFile 15 | 16 | CFBundleTypeName 17 | DocumentType 18 | CFBundleTypeOSTypes 19 | 20 | ???? 21 | 22 | CFBundleTypeRole 23 | Editor 24 | NSDocumentClass 25 | $(PRODUCT_MODULE_NAME).Document 26 | 27 | 28 | CFBundleExecutable 29 | $(EXECUTABLE_NAME) 30 | CFBundleIconFile 31 | 32 | CFBundleIdentifier 33 | $(PRODUCT_BUNDLE_IDENTIFIER) 34 | CFBundleInfoDictionaryVersion 35 | 6.0 36 | CFBundleName 37 | $(PRODUCT_NAME) 38 | CFBundlePackageType 39 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 40 | CFBundleShortVersionString 41 | 0.1.3 42 | CFBundleVersion 43 | 1 44 | LSMinimumSystemVersion 45 | $(MACOSX_DEPLOYMENT_TARGET) 46 | NSHumanReadableCopyright 47 | Copyright © 2020 Kishikawa Katsumi. All rights reserved. 48 | NSMainStoryboardFile 49 | Main 50 | NSPrincipalClass 51 | NSApplication 52 | NSSupportsAutomaticTermination 53 | 54 | NSSupportsSuddenTermination 55 | 56 | NSCameraUsageDescription 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/07b3cd7a90de3fb5e88303a23d619ebd4cdd807a/Global/macOS.gitignore 2 | 3 | # General 4 | .DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Icon must end with two \r 9 | Icon 10 | 11 | # Thumbnails 12 | ._* 13 | 14 | # Files that might appear in the root of a volume 15 | .DocumentRevisions-V100 16 | .fseventsd 17 | .Spotlight-V100 18 | .TemporaryItems 19 | .Trashes 20 | .VolumeIcon.icns 21 | .com.apple.timemachine.donotpresent 22 | 23 | # Directories potentially created on remote AFP share 24 | .AppleDB 25 | .AppleDesktop 26 | Network Trash Folder 27 | Temporary Items 28 | .apdisk 29 | 30 | 31 | ### https://raw.github.com/github/gitignore/07b3cd7a90de3fb5e88303a23d619ebd4cdd807a/Swift.gitignore 32 | 33 | # Xcode 34 | # 35 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 36 | 37 | ## User settings 38 | xcuserdata/ 39 | 40 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 41 | *.xcscmblueprint 42 | *.xccheckout 43 | 44 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 45 | build/ 46 | DerivedData/ 47 | *.moved-aside 48 | *.pbxuser 49 | !default.pbxuser 50 | *.mode1v3 51 | !default.mode1v3 52 | *.mode2v3 53 | !default.mode2v3 54 | *.perspectivev3 55 | !default.perspectivev3 56 | 57 | ## Obj-C/Swift specific 58 | *.hmap 59 | 60 | ## App packaging 61 | *.ipa 62 | *.dSYM.zip 63 | *.dSYM 64 | 65 | ## Playgrounds 66 | timeline.xctimeline 67 | playground.xcworkspace 68 | 69 | # Swift Package Manager 70 | # 71 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 72 | # Packages/ 73 | # Package.pins 74 | # Package.resolved 75 | # *.xcodeproj 76 | # 77 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 78 | # hence it is not needed unless you have added a package configuration file to your project 79 | # .swiftpm 80 | 81 | .build/ 82 | 83 | # CocoaPods 84 | # 85 | # We recommend against adding the Pods directory to your .gitignore. However 86 | # you should judge for yourself, the pros and cons are mentioned at: 87 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 88 | # 89 | # Pods/ 90 | # 91 | # Add this line if you want to avoid checking in source code from the Xcode workspace 92 | # *.xcworkspace 93 | 94 | # Carthage 95 | # 96 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 97 | # Carthage/Checkouts 98 | 99 | Carthage/Build/ 100 | 101 | # Accio dependency management 102 | Dependencies/ 103 | .accio/ 104 | 105 | # fastlane 106 | # 107 | # It is recommended to not store the screenshots in the git repo. 108 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 109 | # For more information about the recommended setup visit: 110 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 111 | 112 | fastlane/report.xml 113 | fastlane/Preview.html 114 | fastlane/screenshots/**/*.png 115 | fastlane/test_output 116 | 117 | # Code Injection 118 | # 119 | # After new code Injection tools there's a generated folder /iOSInjectionProject 120 | # https://github.com/johnno1962/injectionforxcode 121 | 122 | iOSInjectionProject/ 123 | 124 | 125 | -------------------------------------------------------------------------------- /WithCamera/ResizableView.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | class ResizableView: NSView { 4 | private let resizableArea: CGFloat = 4 5 | private var draggedPoint: CGPoint = .zero 6 | 7 | var onMouseMoved: (Bool) -> Void = { _ in } 8 | var onResize: (CGFloat?, CGFloat?, CursorPosition) -> Void = { (_, _ , _) in } 9 | 10 | override init(frame frameRect: NSRect) { 11 | super.init(frame: frameRect) 12 | updateTrackingAreas() 13 | } 14 | 15 | required init?(coder: NSCoder) { 16 | super.init(coder: coder) 17 | updateTrackingAreas() 18 | } 19 | 20 | override func updateTrackingAreas() { 21 | super.updateTrackingAreas() 22 | 23 | trackingAreas.forEach { area in 24 | removeTrackingArea(area) 25 | } 26 | 27 | addTrackingArea(NSTrackingArea(rect: bounds, options: [ .mouseMoved, .mouseEnteredAndExited, .activeAlways], owner: self)) 28 | } 29 | 30 | override func mouseExited(with event: NSEvent) { 31 | super.mouseExited(with: event) 32 | NSCursor.arrow.set() 33 | } 34 | 35 | override func mouseDown(with event: NSEvent) { 36 | super.mouseDown(with: event) 37 | let locationInView = convert(event.locationInWindow, from: nil) 38 | draggedPoint = locationInView 39 | } 40 | 41 | override func mouseUp(with event: NSEvent) { 42 | super.mouseUp(with: event) 43 | draggedPoint = .zero 44 | } 45 | 46 | override func mouseMoved(with event: NSEvent) { 47 | super.mouseMoved(with: event) 48 | let locationInView = convert(event.locationInWindow, from: nil) 49 | let position = cursorPosition(locationInView) 50 | onMouseMoved(position != nil) 51 | } 52 | 53 | override func mouseDragged(with event: NSEvent) { 54 | super.mouseDragged(with: event) 55 | // borderWidth = resizableArea 56 | let locationInView = convert(event.locationInWindow, from: nil) 57 | let horizontalDistanceDragged = locationInView.x - draggedPoint.x 58 | let verticalDistanceDragged = locationInView.y - draggedPoint.y 59 | 60 | guard let cursorPosition = cursorPosition(draggedPoint) else { return } 61 | 62 | var width: CGFloat? 63 | var height: CGFloat? 64 | if cursorPosition.contains(.top) { 65 | height = frame.height + verticalDistanceDragged 66 | draggedPoint = locationInView 67 | } 68 | if cursorPosition.contains(.left) { 69 | width = frame.width - horizontalDistanceDragged 70 | } 71 | if cursorPosition.contains(.bottom) { 72 | height = frame.height - verticalDistanceDragged 73 | } 74 | if cursorPosition.contains(.right) { 75 | width = frame.width + horizontalDistanceDragged 76 | draggedPoint = locationInView 77 | } 78 | onResize(width, height, cursorPosition) 79 | } 80 | 81 | @discardableResult 82 | func cursorPosition(_ locationInView: CGPoint) -> CursorPosition? { 83 | if locationInView.x < resizableArea && locationInView.y < resizableArea { 84 | if let object = NSCursor.self.perform(Selector(("_windowResizeNorthEastSouthWestCursor"))), let cursor = object.takeUnretainedValue() as? NSCursor { 85 | cursor.set() 86 | } 87 | return [.bottom, .left] 88 | } else if locationInView.x < resizableArea && locationInView.y > bounds.height - resizableArea { 89 | if let object = NSCursor.self.perform(Selector(("_windowResizeNorthWestSouthEastCursor"))), let cursor = object.takeUnretainedValue() as? NSCursor { 90 | cursor.set() 91 | } 92 | return [.top, .left] 93 | } else if locationInView.x > bounds.width - resizableArea && locationInView.y < resizableArea { 94 | if let object = NSCursor.self.perform(Selector(("_windowResizeNorthWestSouthEastCursor"))), let cursor = object.takeUnretainedValue() as? NSCursor { 95 | cursor.set() 96 | } 97 | return [.bottom, .right] 98 | } else if locationInView.x > bounds.width - resizableArea && locationInView.y > bounds.height - resizableArea { 99 | if let object = NSCursor.self.perform(Selector(("_windowResizeNorthEastSouthWestCursor"))), let cursor = object.takeUnretainedValue() as? NSCursor { 100 | cursor.set() 101 | } 102 | return [.top, .right] 103 | } else if locationInView.x < resizableArea { 104 | NSCursor.resizeLeftRight.set() 105 | return .left 106 | } else if locationInView.x > bounds.width - resizableArea { 107 | NSCursor.resizeLeftRight.set() 108 | return .right 109 | } else if locationInView.y < resizableArea { 110 | NSCursor.resizeUpDown.set() 111 | return .bottom 112 | } else if locationInView.y > bounds.height - resizableArea { 113 | NSCursor.resizeUpDown.set() 114 | return .top 115 | } else { 116 | NSCursor.arrow.set() 117 | return nil 118 | } 119 | } 120 | 121 | struct CursorPosition: OptionSet { 122 | let rawValue: Int 123 | 124 | static let top = CursorPosition(rawValue: 1 << 0) 125 | static let left = CursorPosition(rawValue: 1 << 1) 126 | static let bottom = CursorPosition(rawValue: 1 << 2) 127 | static let right = CursorPosition(rawValue: 1 << 3) 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /WithCamera/ViewController.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import WebKit 3 | import Quartz.QuickLookUI 4 | import AVFoundation 5 | 6 | final class ViewController: NSViewController { 7 | @IBOutlet private var textField: NSTextField! 8 | 9 | @IBOutlet private var webView: WKWebView! 10 | private let urlSession = URLSession(configuration: .default) 11 | 12 | @IBOutlet private var previewViewContainer: NSView! 13 | private var previewView = QLPreviewView(frame: .zero, style: .compact)! 14 | 15 | @IBOutlet private var dragDropView: DragDropView! 16 | 17 | @IBOutlet private var videoCaptureViewContainer: ResizableView! 18 | @IBOutlet private var videoCaptureViewContainerTrailing: NSLayoutConstraint! 19 | @IBOutlet private var videoCaptureViewContainerBottom: NSLayoutConstraint! 20 | @IBOutlet private var videoCaptureView: NSView! 21 | @IBOutlet private var videoCaptureViewHeight: NSLayoutConstraint! 22 | 23 | private let captureSession = AVCaptureSession() 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | 28 | view.wantsLayer = true 29 | view.layer?.backgroundColor = .white 30 | 31 | webView.isHidden = true 32 | webView.navigationDelegate = self 33 | 34 | previewView.isHidden = true 35 | previewView.translatesAutoresizingMaskIntoConstraints = false 36 | previewViewContainer.addSubview(previewView) 37 | NSLayoutConstraint.activate([ 38 | previewView.topAnchor.constraint(equalTo: previewViewContainer.topAnchor), 39 | previewView.leadingAnchor.constraint(equalTo: previewViewContainer.leadingAnchor), 40 | previewView.trailingAnchor.constraint(equalTo: previewViewContainer.trailingAnchor), 41 | previewView.bottomAnchor.constraint(equalTo: previewViewContainer.bottomAnchor), 42 | ]) 43 | 44 | dragDropView.onDrop = { [weak self] in 45 | self?.showFilePreview($0) 46 | } 47 | 48 | videoCaptureViewContainer.wantsLayer = true 49 | videoCaptureViewContainer.layer?.masksToBounds = false 50 | videoCaptureViewContainer.layer?.shadowColor = .black 51 | videoCaptureViewContainer.layer?.shadowOpacity = 0.2 52 | videoCaptureViewContainer.layer?.shadowRadius = 6 53 | videoCaptureViewContainer.layer?.shadowOffset = CGSize(width: 0, height: -2) 54 | 55 | let panGestureRecognizer = NSPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:))) 56 | videoCaptureViewContainer.addGestureRecognizer(panGestureRecognizer) 57 | 58 | videoCaptureViewContainer.onMouseMoved = { 59 | panGestureRecognizer.isEnabled = !$0 60 | } 61 | videoCaptureViewContainer.onResize = { [weak self] (width, height, cursorPosition) in 62 | guard let self = self else { return } 63 | 64 | if let width = width { 65 | if cursorPosition.contains(.right) { 66 | self.videoCaptureViewContainerTrailing.constant -= width - self.videoCaptureViewHeight.constant * (16 / 9) 67 | } 68 | self.videoCaptureViewHeight.constant = width * (9 / 16) 69 | } 70 | if let height = height { 71 | if cursorPosition.contains(.bottom) { 72 | self.videoCaptureViewContainerBottom.constant -= height - self.videoCaptureViewHeight.constant 73 | } 74 | self.videoCaptureViewHeight.constant = height 75 | } 76 | } 77 | 78 | videoCaptureView.wantsLayer = true 79 | videoCaptureView.layer?.cornerRadius = 6 80 | 81 | if let device = AVCaptureDevice.default(for: .video), 82 | let input = try? AVCaptureDeviceInput(device: device), 83 | captureSession.canAddInput(input) { 84 | captureSession.addInput(input) 85 | } 86 | 87 | let previewLayer = AVCaptureVideoPreviewLayer() 88 | previewLayer.autoresizingMask = [.layerWidthSizable, .layerHeightSizable] 89 | previewLayer.videoGravity = .resizeAspectFill 90 | previewLayer.session = captureSession 91 | if let layer = videoCaptureView.layer { 92 | previewLayer.frame = layer.bounds 93 | layer.addSublayer(previewLayer) 94 | } 95 | 96 | captureSession.startRunning() 97 | } 98 | 99 | @IBAction 100 | private func textFieldAction(_ sender: NSTextField) { 101 | webView.isHidden = false 102 | 103 | if var components = URLComponents(string: sender.stringValue) { 104 | components.scheme = "https" 105 | if let url = components.url { 106 | let request = URLRequest(url: url) 107 | urlSession.dataTask(with: url) { [weak self] (data, response, error) in 108 | DispatchQueue.main.async { 109 | if let _ = error { 110 | var components = URLComponents(string: "https://www.google.com/search") 111 | components?.queryItems = [URLQueryItem(name: "q", value: sender.stringValue)] 112 | if let url = components?.url { 113 | self?.loadWebView(URLRequest(url: url)) 114 | } 115 | } else { 116 | self?.loadWebView(request) 117 | } 118 | } 119 | } 120 | .resume() 121 | } 122 | } 123 | } 124 | 125 | private func loadWebView(_ request: URLRequest) { 126 | webView.isHidden = false 127 | previewView.isHidden = true 128 | webView.load(request) 129 | } 130 | 131 | @IBAction 132 | private func browseFile(_ sender: NSButton) { 133 | let openPanel = NSOpenPanel(); 134 | 135 | openPanel.showsResizeIndicator = true; 136 | openPanel.showsHiddenFiles = false; 137 | openPanel.canChooseDirectories = false; 138 | openPanel.canCreateDirectories = false; 139 | openPanel.allowsMultipleSelection = false; 140 | 141 | openPanel.beginSheetModal(for: view.window!) { [weak self] (response) in 142 | if response == .OK, let url = openPanel.url { 143 | self?.showFilePreview(url) 144 | } 145 | } 146 | } 147 | 148 | private func showFilePreview(_ url: URL) { 149 | webView.isHidden = true 150 | previewView.isHidden = false 151 | previewView.previewItem = PreviewItem(url: url) 152 | } 153 | 154 | @objc 155 | private func handlePanGesture(_ sender: NSPanGestureRecognizer) { 156 | guard NSCursor.current == NSCursor.arrow else { return } 157 | 158 | let translation = sender.translation(in: view) 159 | switch sender.state { 160 | case .possible, .began: 161 | break 162 | case .changed: 163 | videoCaptureViewContainerTrailing.constant -= translation.x 164 | videoCaptureViewContainerBottom.constant += translation.y 165 | case .ended, .cancelled, .failed: 166 | break 167 | @unknown default: 168 | break 169 | } 170 | sender.setTranslation(.zero, in: view) 171 | } 172 | } 173 | 174 | extension ViewController: WKNavigationDelegate { 175 | func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { 176 | if let absoluteString = webView.url?.absoluteString { 177 | textField.stringValue = absoluteString 178 | } 179 | } 180 | 181 | func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { 182 | let alert = NSAlert(error: error) 183 | alert.beginSheetModal(for: view.window!) 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /WithCamera.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 146A8E042467BB4D00BDAECD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146A8E032467BB4D00BDAECD /* AppDelegate.swift */; }; 11 | 146A8E062467BB4D00BDAECD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146A8E052467BB4D00BDAECD /* ViewController.swift */; }; 12 | 146A8E082467BB4D00BDAECD /* Document.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146A8E072467BB4D00BDAECD /* Document.swift */; }; 13 | 146A8E0A2467BB4F00BDAECD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 146A8E092467BB4F00BDAECD /* Assets.xcassets */; }; 14 | 146A8E0D2467BB4F00BDAECD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 146A8E0B2467BB4F00BDAECD /* Main.storyboard */; }; 15 | 146A8E172467E3CF00BDAECD /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 146A8E162467E3CF00BDAECD /* WebKit.framework */; }; 16 | 146A8E192467F3CD00BDAECD /* ResizableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146A8E182467F3CD00BDAECD /* ResizableView.swift */; }; 17 | 146A8E1B2467F3E700BDAECD /* DragDropView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146A8E1A2467F3E700BDAECD /* DragDropView.swift */; }; 18 | 146A8E1D2467F41500BDAECD /* PreviewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146A8E1C2467F41500BDAECD /* PreviewItem.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 146A8E002467BB4D00BDAECD /* WithCamera.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WithCamera.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 146A8E032467BB4D00BDAECD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | 146A8E052467BB4D00BDAECD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 25 | 146A8E072467BB4D00BDAECD /* Document.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Document.swift; sourceTree = ""; }; 26 | 146A8E092467BB4F00BDAECD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | 146A8E0C2467BB4F00BDAECD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 146A8E0E2467BB4F00BDAECD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 146A8E0F2467BB4F00BDAECD /* WithCamera.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WithCamera.entitlements; sourceTree = ""; }; 30 | 146A8E162467E3CF00BDAECD /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 31 | 146A8E182467F3CD00BDAECD /* ResizableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResizableView.swift; sourceTree = ""; }; 32 | 146A8E1A2467F3E700BDAECD /* DragDropView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragDropView.swift; sourceTree = ""; }; 33 | 146A8E1C2467F41500BDAECD /* PreviewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewItem.swift; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | 146A8DFD2467BB4D00BDAECD /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | 146A8E172467E3CF00BDAECD /* WebKit.framework in Frameworks */, 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 146A8DF72467BB4D00BDAECD = { 49 | isa = PBXGroup; 50 | children = ( 51 | 146A8E022467BB4D00BDAECD /* WithCamera */, 52 | 146A8E012467BB4D00BDAECD /* Products */, 53 | 146A8E152467E3CE00BDAECD /* Frameworks */, 54 | ); 55 | sourceTree = ""; 56 | }; 57 | 146A8E012467BB4D00BDAECD /* Products */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 146A8E002467BB4D00BDAECD /* WithCamera.app */, 61 | ); 62 | name = Products; 63 | sourceTree = ""; 64 | }; 65 | 146A8E022467BB4D00BDAECD /* WithCamera */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 146A8E032467BB4D00BDAECD /* AppDelegate.swift */, 69 | 146A8E052467BB4D00BDAECD /* ViewController.swift */, 70 | 146A8E072467BB4D00BDAECD /* Document.swift */, 71 | 146A8E1A2467F3E700BDAECD /* DragDropView.swift */, 72 | 146A8E182467F3CD00BDAECD /* ResizableView.swift */, 73 | 146A8E1C2467F41500BDAECD /* PreviewItem.swift */, 74 | 146A8E0B2467BB4F00BDAECD /* Main.storyboard */, 75 | 146A8E092467BB4F00BDAECD /* Assets.xcassets */, 76 | 146A8E0F2467BB4F00BDAECD /* WithCamera.entitlements */, 77 | 146A8E0E2467BB4F00BDAECD /* Info.plist */, 78 | ); 79 | path = WithCamera; 80 | sourceTree = ""; 81 | }; 82 | 146A8E152467E3CE00BDAECD /* Frameworks */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 146A8E162467E3CF00BDAECD /* WebKit.framework */, 86 | ); 87 | name = Frameworks; 88 | sourceTree = ""; 89 | }; 90 | /* End PBXGroup section */ 91 | 92 | /* Begin PBXNativeTarget section */ 93 | 146A8DFF2467BB4D00BDAECD /* WithCamera */ = { 94 | isa = PBXNativeTarget; 95 | buildConfigurationList = 146A8E122467BB4F00BDAECD /* Build configuration list for PBXNativeTarget "WithCamera" */; 96 | buildPhases = ( 97 | 146A8DFC2467BB4D00BDAECD /* Sources */, 98 | 146A8DFD2467BB4D00BDAECD /* Frameworks */, 99 | 146A8DFE2467BB4D00BDAECD /* Resources */, 100 | ); 101 | buildRules = ( 102 | ); 103 | dependencies = ( 104 | ); 105 | name = WithCamera; 106 | productName = WithCamera; 107 | productReference = 146A8E002467BB4D00BDAECD /* WithCamera.app */; 108 | productType = "com.apple.product-type.application"; 109 | }; 110 | /* End PBXNativeTarget section */ 111 | 112 | /* Begin PBXProject section */ 113 | 146A8DF82467BB4D00BDAECD /* Project object */ = { 114 | isa = PBXProject; 115 | attributes = { 116 | LastSwiftUpdateCheck = 1140; 117 | LastUpgradeCheck = 1140; 118 | ORGANIZATIONNAME = "Kishikawa Katsumi"; 119 | TargetAttributes = { 120 | 146A8DFF2467BB4D00BDAECD = { 121 | CreatedOnToolsVersion = 11.4.1; 122 | }; 123 | }; 124 | }; 125 | buildConfigurationList = 146A8DFB2467BB4D00BDAECD /* Build configuration list for PBXProject "WithCamera" */; 126 | compatibilityVersion = "Xcode 9.3"; 127 | developmentRegion = en; 128 | hasScannedForEncodings = 0; 129 | knownRegions = ( 130 | en, 131 | Base, 132 | ); 133 | mainGroup = 146A8DF72467BB4D00BDAECD; 134 | productRefGroup = 146A8E012467BB4D00BDAECD /* Products */; 135 | projectDirPath = ""; 136 | projectRoot = ""; 137 | targets = ( 138 | 146A8DFF2467BB4D00BDAECD /* WithCamera */, 139 | ); 140 | }; 141 | /* End PBXProject section */ 142 | 143 | /* Begin PBXResourcesBuildPhase section */ 144 | 146A8DFE2467BB4D00BDAECD /* Resources */ = { 145 | isa = PBXResourcesBuildPhase; 146 | buildActionMask = 2147483647; 147 | files = ( 148 | 146A8E0A2467BB4F00BDAECD /* Assets.xcassets in Resources */, 149 | 146A8E0D2467BB4F00BDAECD /* Main.storyboard in Resources */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | /* End PBXResourcesBuildPhase section */ 154 | 155 | /* Begin PBXSourcesBuildPhase section */ 156 | 146A8DFC2467BB4D00BDAECD /* Sources */ = { 157 | isa = PBXSourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 146A8E1B2467F3E700BDAECD /* DragDropView.swift in Sources */, 161 | 146A8E062467BB4D00BDAECD /* ViewController.swift in Sources */, 162 | 146A8E042467BB4D00BDAECD /* AppDelegate.swift in Sources */, 163 | 146A8E1D2467F41500BDAECD /* PreviewItem.swift in Sources */, 164 | 146A8E192467F3CD00BDAECD /* ResizableView.swift in Sources */, 165 | 146A8E082467BB4D00BDAECD /* Document.swift in Sources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXSourcesBuildPhase section */ 170 | 171 | /* Begin PBXVariantGroup section */ 172 | 146A8E0B2467BB4F00BDAECD /* Main.storyboard */ = { 173 | isa = PBXVariantGroup; 174 | children = ( 175 | 146A8E0C2467BB4F00BDAECD /* Base */, 176 | ); 177 | name = Main.storyboard; 178 | sourceTree = ""; 179 | }; 180 | /* End PBXVariantGroup section */ 181 | 182 | /* Begin XCBuildConfiguration section */ 183 | 146A8E102467BB4F00BDAECD /* Debug */ = { 184 | isa = XCBuildConfiguration; 185 | buildSettings = { 186 | ALWAYS_SEARCH_USER_PATHS = NO; 187 | CLANG_ANALYZER_NONNULL = YES; 188 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 189 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 190 | CLANG_CXX_LIBRARY = "libc++"; 191 | CLANG_ENABLE_MODULES = YES; 192 | CLANG_ENABLE_OBJC_ARC = YES; 193 | CLANG_ENABLE_OBJC_WEAK = YES; 194 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 195 | CLANG_WARN_BOOL_CONVERSION = YES; 196 | CLANG_WARN_COMMA = YES; 197 | CLANG_WARN_CONSTANT_CONVERSION = YES; 198 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 199 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 200 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 201 | CLANG_WARN_EMPTY_BODY = YES; 202 | CLANG_WARN_ENUM_CONVERSION = YES; 203 | CLANG_WARN_INFINITE_RECURSION = YES; 204 | CLANG_WARN_INT_CONVERSION = YES; 205 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 206 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 207 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 208 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 209 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 210 | CLANG_WARN_STRICT_PROTOTYPES = YES; 211 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 212 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 213 | CLANG_WARN_UNREACHABLE_CODE = YES; 214 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 215 | COPY_PHASE_STRIP = NO; 216 | DEBUG_INFORMATION_FORMAT = dwarf; 217 | ENABLE_STRICT_OBJC_MSGSEND = YES; 218 | ENABLE_TESTABILITY = YES; 219 | GCC_C_LANGUAGE_STANDARD = gnu11; 220 | GCC_DYNAMIC_NO_PIC = NO; 221 | GCC_NO_COMMON_BLOCKS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PREPROCESSOR_DEFINITIONS = ( 224 | "DEBUG=1", 225 | "$(inherited)", 226 | ); 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 229 | GCC_WARN_UNDECLARED_SELECTOR = YES; 230 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 231 | GCC_WARN_UNUSED_FUNCTION = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | MACOSX_DEPLOYMENT_TARGET = 10.13; 234 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 235 | MTL_FAST_MATH = YES; 236 | ONLY_ACTIVE_ARCH = YES; 237 | SDKROOT = macosx; 238 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 239 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 240 | }; 241 | name = Debug; 242 | }; 243 | 146A8E112467BB4F00BDAECD /* Release */ = { 244 | isa = XCBuildConfiguration; 245 | buildSettings = { 246 | ALWAYS_SEARCH_USER_PATHS = NO; 247 | CLANG_ANALYZER_NONNULL = YES; 248 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 249 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 250 | CLANG_CXX_LIBRARY = "libc++"; 251 | CLANG_ENABLE_MODULES = YES; 252 | CLANG_ENABLE_OBJC_ARC = YES; 253 | CLANG_ENABLE_OBJC_WEAK = YES; 254 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 255 | CLANG_WARN_BOOL_CONVERSION = YES; 256 | CLANG_WARN_COMMA = YES; 257 | CLANG_WARN_CONSTANT_CONVERSION = YES; 258 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 259 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 260 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 261 | CLANG_WARN_EMPTY_BODY = YES; 262 | CLANG_WARN_ENUM_CONVERSION = YES; 263 | CLANG_WARN_INFINITE_RECURSION = YES; 264 | CLANG_WARN_INT_CONVERSION = YES; 265 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 266 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 267 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 270 | CLANG_WARN_STRICT_PROTOTYPES = YES; 271 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 272 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 273 | CLANG_WARN_UNREACHABLE_CODE = YES; 274 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 275 | COPY_PHASE_STRIP = NO; 276 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 277 | ENABLE_NS_ASSERTIONS = NO; 278 | ENABLE_STRICT_OBJC_MSGSEND = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu11; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | MACOSX_DEPLOYMENT_TARGET = 10.13; 288 | MTL_ENABLE_DEBUG_INFO = NO; 289 | MTL_FAST_MATH = YES; 290 | SDKROOT = macosx; 291 | SWIFT_COMPILATION_MODE = wholemodule; 292 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 293 | }; 294 | name = Release; 295 | }; 296 | 146A8E132467BB4F00BDAECD /* Debug */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 300 | CODE_SIGN_ENTITLEMENTS = WithCamera/WithCamera.entitlements; 301 | CODE_SIGN_STYLE = Automatic; 302 | COMBINE_HIDPI_IMAGES = YES; 303 | DEVELOPMENT_TEAM = 27AEDK3C9F; 304 | ENABLE_HARDENED_RUNTIME = YES; 305 | INFOPLIST_FILE = WithCamera/Info.plist; 306 | LD_RUNPATH_SEARCH_PATHS = ( 307 | "$(inherited)", 308 | "@executable_path/../Frameworks", 309 | ); 310 | PRODUCT_BUNDLE_IDENTIFIER = com.kishikawakatsumi.WithCamera; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | SWIFT_VERSION = 5.0; 313 | }; 314 | name = Debug; 315 | }; 316 | 146A8E142467BB4F00BDAECD /* Release */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 320 | CODE_SIGN_ENTITLEMENTS = WithCamera/WithCamera.entitlements; 321 | CODE_SIGN_STYLE = Automatic; 322 | COMBINE_HIDPI_IMAGES = YES; 323 | DEVELOPMENT_TEAM = 27AEDK3C9F; 324 | ENABLE_HARDENED_RUNTIME = YES; 325 | INFOPLIST_FILE = WithCamera/Info.plist; 326 | LD_RUNPATH_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "@executable_path/../Frameworks", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = com.kishikawakatsumi.WithCamera; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | SWIFT_VERSION = 5.0; 333 | }; 334 | name = Release; 335 | }; 336 | /* End XCBuildConfiguration section */ 337 | 338 | /* Begin XCConfigurationList section */ 339 | 146A8DFB2467BB4D00BDAECD /* Build configuration list for PBXProject "WithCamera" */ = { 340 | isa = XCConfigurationList; 341 | buildConfigurations = ( 342 | 146A8E102467BB4F00BDAECD /* Debug */, 343 | 146A8E112467BB4F00BDAECD /* Release */, 344 | ); 345 | defaultConfigurationIsVisible = 0; 346 | defaultConfigurationName = Release; 347 | }; 348 | 146A8E122467BB4F00BDAECD /* Build configuration list for PBXNativeTarget "WithCamera" */ = { 349 | isa = XCConfigurationList; 350 | buildConfigurations = ( 351 | 146A8E132467BB4F00BDAECD /* Debug */, 352 | 146A8E142467BB4F00BDAECD /* Release */, 353 | ); 354 | defaultConfigurationIsVisible = 0; 355 | defaultConfigurationName = Release; 356 | }; 357 | /* End XCConfigurationList section */ 358 | }; 359 | rootObject = 146A8DF82467BB4D00BDAECD /* Project object */; 360 | } 361 | -------------------------------------------------------------------------------- /WithCamera/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | Default 531 | 532 | 533 | 534 | 535 | 536 | 537 | Left to Right 538 | 539 | 540 | 541 | 542 | 543 | 544 | Right to Left 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | Default 556 | 557 | 558 | 559 | 560 | 561 | 562 | Left to Right 563 | 564 | 565 | 566 | 567 | 568 | 569 | Right to Left 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | --------------------------------------------------------------------------------