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 AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
// Any other set-up code you need. | |
// This allows us to access the navigation bar since .appearance returns the proxy for the receiver, | |
// our UINavigationBar. | |
let navigationBarAppearace = UINavigationBar.appearance() | |
// This colour applies to the navigation items and bar button items. |
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
require "fastlane_core" | |
require "credentials_manager" | |
module Gym | |
class Options | |
def self.available_options | |
return @options if @options | |
@options = plain_options | |
end |
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
func beginSession() { | |
do { | |
let deviceInput = try AVCaptureDeviceInput(device: self.captureDevice) | |
self.captureSession.addInput(deviceInput) | |
} catch { | |
// Handle error and return early. | |
} | |
self.previewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession) | |
if let preview = self.previewLayer { |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
let deviceTypes: [AVCaptureDeviceType] = [.builtInDuoCamera, .builtInTelephotoCamera, .builtInWideAngleCamera] | |
let devices = AVCaptureDeviceDiscoverySession(deviceTypes: deviceTypes, mediaType: AVMediaTypeVideo, position: .back).devices | |
if let device = devices?.first { | |
self.captureDevice = device | |
beginSession() | |
} |
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 captureSession = AVCaptureSession() | |
var captureDevice: AVCaptureDevice? | |
var previewLayer: AVCaptureVideoPreviewLayer? |
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
if let popoverController = alertController.popoverPresentationController { | |
popoverController.sourceView = self.view | |
popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) | |
popoverController.permittedArrowDirections = [] | |
} |
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
if let popoverController = alertController.popoverPresentationController { | |
popoverController.sourceView = self.view | |
popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) | |
} |
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
@IBAction func showDeleteActionSheet(_ sender: AnyObject) { | |
let alertController = UIAlertController(title: nil, message: "Alert message.", preferredStyle: .actionSheet) | |
let defaultAction = UIAlertAction(title: "Default", style: .default, handler: { (alert: UIAlertAction!) -> Void in | |
// Do some action here. | |
}) | |
let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (alert: UIAlertAction!) -> Void in | |
// Do some destructive action here. | |
}) |
NewerOlder