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
// MARK: - Frameworks | |
import SwiftUI | |
// MARK: - CircleImage | |
struct CircleImage: View { | |
var image: Image | |
var body: some View { |
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
// MARK: - Frameworks | |
import SwiftUI | |
// MARK: - AnimalRow | |
struct AnimalRow: View { | |
var animal: Animal | |
var body: some View { |
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
// MARK: - Frameworks | |
import SwiftUI | |
// MARK: - AnimalDetail | |
struct AnimalDetail: View { | |
var animal: Animal | |
var body: some View { |
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
// MARK: - Frameworks | |
import SwiftUI | |
// MARK: - AnimalList | |
struct AnimalList: View { | |
var body: some View { | |
NavigationView { | |
List(Animal.all) { animal in |
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
// MARK: - Animal Constants | |
extension Animal { | |
static let all: [Animal] = [.lion, .elephant, .giraffe, .zebra] | |
static let lion = Animal(id: 1, name: "Lion", | |
description: "Biggest cat in Africa, the king of the jungle.", | |
imageName: "lion") | |
static let elephant = Animal(id: 2, name: "Elephant", | |
description: "Huge plant eating animal with long nose.", |
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
// MARK: - Frameworks | |
import SwiftUI | |
// MARK: - Animal | |
struct Animal: Hashable, Identifiable { | |
// MARK: - Variables | |
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
extension UIDevice { | |
private class JailbreakDetector { | |
static var current: JailbreakDetector = JailbreakDetector() | |
lazy var containsSuspiciousFiles: Bool = { | |
return (["/Applications/Cydia.app", | |
"/Library/MobileSubstrate/MobileSubstrate.dylib", | |
"/bin/bash", | |
"/usr/sbin/sshd", |
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 setTorch(on: Bool) { | |
guard let device = AVCaptureDevice.default(for: AVMediaType.video), | |
device.hasTorch else { | |
return | |
} | |
do { | |
try device.lockForConfiguration() | |
if on { |
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
// MARK: LoginViewController | |
class LoginViewController: UIViewController { | |
func login(with username: String, | |
password: String) { | |
let authenticationSession = AuthenticationSession() | |
authenticationSession.performLogin(with: username, | |
password: password, | |
completion: { userIdentifier in |
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
// MARK: LoginViewController | |
class LoginViewController: UIViewController, AuthenticationSessionDelegate { | |
func login(with username: String, | |
password: String) { | |
let authenticationSession = AuthenticationSession() | |
authenticationSession.delegate = self | |
authenticationSession.performLogin(with: username, | |
password: password) |
NewerOlder