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
import SwiftUI | |
struct BottomFindableScrollView<Content: View>: View { | |
private let axes: Axis.Set | |
private let showsIndicators: Bool | |
@Binding private var bottomReached: Bool | |
private let content: Content | |
private let coordinateSpaceName = "scrollSize" | |
@State private var wholeSize: CGSize = .zero |
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
import UIKit | |
import SnapshotTesting | |
private let precision: Float = 0.9 | |
// MARK: - UIViewController | |
extension Snapshotting where Value == UIViewController, Format == UIImage { | |
/// A snapshot strategy for comparing views based on pixel equality. | |
public static var impreciseImage: Snapshotting { |
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
<key>NSAppTransportSecurity</key> | |
<dict> | |
<!--To support localhost --> | |
<key>NSAllowsLocalNetworking</key> | |
<true/> | |
<!--To continue to work for iOS 9 --> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> |
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 UITests: XCTestCase { | |
let app = XCUIApplication() | |
let dynamicStubs = HTTPDynamicStubs() | |
override func setUp() { | |
super.setUp() | |
dynamicStubs.setUp() | |
} |
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
import Foundation | |
import Swifter | |
enum HTTPMethod { | |
case POST | |
case GET | |
} | |
struct HTTPStubInfo { | |
let url: String |
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
private func beInitial() -> Predicate<SearchTableViewController.State> { | |
return Predicate.define("be <initial>") { expression, message in | |
if let actual = try expression.evaluate(), case .initial = actual { | |
return PredicateResult(status: .matches, message: message) | |
} | |
return PredicateResult(status: .fail, message: message) | |
} | |
} |
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
// Just check the enum | |
expect(state).to(beContent()) | |
// Check the enum and verify whatever properties we need from the associated value | |
expect(state).to(beContent { response in | |
expect(response) === expectedResponse | |
}) |
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
private func beContent(test: @escaping (Response) -> Void = { _ in }) -> Predicate<State> { | |
return Predicate.define("be <content>") { expression, message in | |
if let actual = try expression.evaluate(), | |
case let .content(response) = actual { | |
test(response) | |
return PredicateResult(status: .matches, message: message) | |
} | |
return PredicateResult(status: .fail, message: message) | |
} | |
} |
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 case let .content(response) = state { | |
expect(response.foo).to(equal(expectedResponse.foo)) | |
} else { | |
fail("Expected <content> but got <\(state)>") | |
} |
NewerOlder