Skip to content

Instantly share code, notes, and snippets.

View robertofrontado's full-sized avatar
🐶
Working from home

Roberto Frontado robertofrontado

🐶
Working from home
View GitHub Profile
@robertofrontado
robertofrontado / CameraManager.swift
Last active March 5, 2023 16:32
Camera Swift UI
import AVFoundation
import CoreImage
import CoreGraphics
///
class CameraManager: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDelegate {
enum Status {
case unconfigured
case configured
case unauthorized
@robertofrontado
robertofrontado / Operators.swift
Created January 4, 2021 13:47
Swift Operators
import Foundation
// MARK: - Operators
infix operator |> : AdditionPrecedence
infix operator <> : AdditionPrecedence
infix operator >>> : AdditionPrecedence
// MARK: - Implementations
@robertofrontado
robertofrontado / SnapshotTesting-Test-LoginViewController-MultipleDevices.swift
Created September 17, 2020 21:25
SnapshotTesting-Test-LoginViewController-MultipleDevices
import XCTest
import SnapshotTesting
@testable import SampleApp
class LoginViewControllerSnapshotTests: XCTestCase {
func test_loginViewControllerDefaultState() {
let viewController = UINavigationController(rootViewController: LoginViewController2())
verifyViewController(viewController, named: "Default")
}
@robertofrontado
robertofrontado / SnapshotTesting-Test-LoginViewController.swift
Created September 17, 2020 21:06
SnapshotTesting-Test-LoginViewController
import XCTest
import SnapshotTesting
@testable import SampleApp
class LoginViewControllerSnapshotTests: XCTestCase {
func test_loginViewControllerDefaultState() {
let viewController = UINavigationController(rootViewController: LoginViewController2())
@robertofrontado
robertofrontado / SnapshotTesting-Test-Button-LoadingState.swift
Created September 17, 2020 20:04
SnapshotTesting-Test-Button-LoadingState
func test_buttonLoadingState() {
let button = Button(frame: .init(x: 0, y: 0, width: 128, height: 48))
button.setTitle("Login", for: .normal)
button.isLoading = true
let result = verifySnapshot(matching: button,
as: .image,
named: "Loading",
testName: "Button")
@robertofrontado
robertofrontado / SnapshotTesting-Test-Button-DefaultState.swift
Last active September 17, 2020 19:58
SnapshotTesting-Test-Button-DefaultState
import XCTest
import SnapshotTesting
@testable import SampleApp
class ButtonSnapshotTests: XCTestCase {
func test_buttonDefaultState() {
let button = Button(frame: .init(x: 0, y: 0, width: 128, height: 48)) // 1
button.setTitle("Login", for: .normal) // 2
@robertofrontado
robertofrontado / XcodeGenSample-modular-main-swiftlint-project.yml
Created July 8, 2020 20:23
Project spec used to generate a modular application with Swiftlint
name: XcodeGenSample
options:
bundleIdPrefix: com.frontado
deploymentTarget:
iOS: 13.0
targets:
XcodeGenSample:
type: application
platform: iOS
sources:
@robertofrontado
robertofrontado / XcodeGenSample-modular-profile-project.yml
Created July 8, 2020 20:17
Project spec used to generate a modular application - File 3
name: Profile
options:
bundleIdPrefix: com.frontado
deploymentTarget:
iOS: 13.0
targets:
Profile:
type: framework
platform: iOS
sources:
@robertofrontado
robertofrontado / XcodeGenSample-modular-authentication-project.yml
Created July 8, 2020 20:17
Project spec used to generate a modular application - File 2
name: Authentication
options:
bundleIdPrefix: com.frontado
deploymentTarget:
iOS: 13.0
targets:
Authentication:
type: framework
platform: iOS
sources:
@robertofrontado
robertofrontado / XcodeGenSample-modular-main-project.yml
Created July 8, 2020 20:15
Project spec used to generate a modular application - File 1
name: XcodeGenSample
options:
bundleIdPrefix: com.frontado
deploymentTarget:
iOS: 13.0
targets:
XcodeGenSample:
type: application
platform: iOS
sources: