This file contains hidden or 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
struct DelayAppearanceModifier: ViewModifier { | |
var animation: Animation | |
var delay: TimeInterval | |
var offset: CGSize | |
@State private var isShown: Bool = false | |
func body(content: Content) -> some View { | |
content | |
.opacity(isShown ? 1 : 0) | |
.offset(x: isShown ? 0 : offset.width, y: isShown ? 0 : offset.height) |
This file contains hidden or 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
import XCTest | |
public extension XCTestCase { | |
/// Runs the assertions provided in the main thread in an async way. | |
/// Useful for testing objects that make async requests (using mocked protocols for the responses) | |
/// - Parameters: | |
/// - expectation: The string representation of what we expect. | |
/// - asyncWaitDuration: Duration in seconds to wait before trying to assert the assertions. Default: 0.05. | |
/// - assertions: escaping method containing all the assertions. | |
func asyncAssert( |
This file contains hidden or 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
import Combine | |
import XCTest | |
/// Runs the assertions provided for the publisher variable. | |
public class AssertState { | |
private var subscribers: Set<AnyCancellable> = [] | |
/// Initializes AssertState object. | |
public init() {} | |
} |
This file contains hidden or 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
import XCTest | |
public extension XCTestCase { | |
/// This is a method to determine that an instance gets deallocated from memory correctly; ie: no memory leaks 😄. | |
/// It leverages the `addTeardownBlock` method on `XCTest`: | |
/// `* Teardown blocks are executed after the current test method has returned but before tearDown is invoked.` | |
func assertMemoryDeallocation( | |
in instance: AnyObject, | |
file: StaticString = #filePath, | |
line: UInt = #line |
This file contains hidden or 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
import SwiftUI | |
public struct SpinnerProgressView: View { | |
@State private var isLoading = false | |
private let color: Color | |
private let size: CGFloat | |
private let lineWidth: CGFloat | |
public init( | |
color: Color = .accentColor, |
This file contains hidden or 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
// | |
// PrimaryTextField.swift | |
// | |
// | |
// Created by Manu on 31/01/2023. | |
// | |
import SwiftUI | |
struct PrimaryTextField: View { |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>SupportsSwiftPackage</key> | |
<true/> | |
<key>Kind</key> | |
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string> | |
<key>Description</key> | |
<string>A SwiftUI View with it's ViewModel and the Mocks</string> |
This file contains hidden or 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
//___FILEHEADER___ | |
import Foundation | |
extension ___VARIABLE_ViewName___ { | |
final class ViewModel: ObservableObject { | |
private let dependencies: Dependencies | |
init(dependencies: Dependencies = .default) { | |
self.dependencies = dependencies |
This file contains hidden or 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
//___FILEHEADER___ | |
import Foundation | |
extension ___VARIABLE_ViewName___.ViewModel.Dependencies { | |
static var mock: Self { | |
.init { | |
// TODO: Replace me | |
return | |
} |