Skip to content

Commit

Permalink
Merge pull request #268 from younata/fix_xcode_15_build
Browse files Browse the repository at this point in the history
Fix building on Xcode 15 by specifying Nimble.Predicate
  • Loading branch information
younata committed Jun 6, 2023
2 parents bc7d2c7 + 548ad0e commit 9e4ab0a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Nimble_Snapshots/DynamicSize/DynamicSizeSnapshot.swift
Expand Up @@ -153,7 +153,7 @@ public func haveValidDynamicSizeSnapshot<T: Snapshotable>(named name: String? =
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
resizeMode: ResizeMode = .frame,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {
return Predicate { actualExpression in
return performDynamicSizeSnapshotTest(name,
identifier: identifier,
Expand Down Expand Up @@ -250,7 +250,7 @@ public func recordDynamicSizeSnapshot<T: Snapshotable>(named name: String? = nil
isDeviceAgnostic: Bool = false,
usesDrawRect: Bool = false,
resizeMode: ResizeMode = .frame,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {
return Predicate { actualExpression in
return performDynamicSizeSnapshotTest(name,
identifier: identifier,
Expand Down
20 changes: 10 additions & 10 deletions Nimble_Snapshots/DynamicType/HaveValidDynamicTypeSnapshot.swift
Expand Up @@ -15,8 +15,8 @@ func shortCategoryName(_ category: UIContentSizeCategory) -> String {
return category.rawValue.replacingOccurrences(of: "UICTContentSizeCategory", with: "")
}

func combinePredicates<T>(_ predicates: [Predicate<T>],
deferred: (() -> Void)? = nil) -> Predicate<T> {
func combinePredicates<T>(_ predicates: [Nimble.Predicate<T>],
deferred: (() -> Void)? = nil) -> Nimble.Predicate<T> {
return Predicate { actualExpression in
defer {
deferred?()
Expand All @@ -37,18 +37,18 @@ public func haveValidDynamicTypeSnapshot<T: Snapshotable>(named name: String? =
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
sizes: [UIContentSizeCategory] = allContentSizeCategories(),
isDeviceAgnostic: Bool = false) -> Predicate<T> {
isDeviceAgnostic: Bool = false) -> Nimble.Predicate<T> {
let mock = NBSMockedApplication()

let predicates: [Predicate<T>] = sizes.map { category in
let predicates: [Nimble.Predicate<T>] = sizes.map { category in
let sanitizedName = sanitizedTestName(name)
let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))"

return Predicate { actualExpression in
return Nimble.Predicate { actualExpression in
mock.mockPreferredContentSizeCategory(category)
updateTraitCollection(on: actualExpression)

let predicate: Predicate<T>
let predicate: Nimble.Predicate<T>
if isDeviceAgnostic {
predicate = haveValidDeviceAgnosticSnapshot(named: nameWithCategory, identifier: identifier,
usesDrawRect: usesDrawRect, pixelTolerance: pixelTolerance,
Expand All @@ -74,18 +74,18 @@ public func recordDynamicTypeSnapshot<T: Snapshotable>(named name: String? = nil
identifier: String? = nil,
usesDrawRect: Bool = false,
sizes: [UIContentSizeCategory] = allContentSizeCategories(),
isDeviceAgnostic: Bool = false) -> Predicate<T> {
isDeviceAgnostic: Bool = false) -> Nimble.Predicate<T> {
let mock = NBSMockedApplication()

let predicates: [Predicate<T>] = sizes.map { category in
let predicates: [Nimble.Predicate<T>] = sizes.map { category in
let sanitizedName = sanitizedTestName(name)
let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))"

return Predicate { actualExpression in
return Nimble.Predicate { actualExpression in
mock.mockPreferredContentSizeCategory(category)
updateTraitCollection(on: actualExpression)

let predicate: Predicate<T>
let predicate: Nimble.Predicate<T>
if isDeviceAgnostic {
predicate = recordDeviceAgnosticSnapshot(named: nameWithCategory,
identifier: identifier,
Expand Down
8 changes: 4 additions & 4 deletions Nimble_Snapshots/HaveValidSnapshot.swift
Expand Up @@ -280,7 +280,7 @@ public func haveValidSnapshot<T: Snapshotable>(named name: String? = nil,
usesDrawRect: Bool = false,
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
if switchChecksWithRecords {
Expand All @@ -306,7 +306,7 @@ public func haveValidDeviceAgnosticSnapshot<T: Snapshotable>(named name: String?
usesDrawRect: Bool = false,
pixelTolerance: CGFloat? = nil,
tolerance: CGFloat? = nil,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
if switchChecksWithRecords {
Expand All @@ -332,7 +332,7 @@ public func haveValidDeviceAgnosticSnapshot<T: Snapshotable>(named name: String?
public func recordSnapshot<T: Snapshotable>(named name: String? = nil,
identifier: String? = nil,
usesDrawRect: Bool = false,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
return recordSnapshot(name, identifier: identifier, usesDrawRect: usesDrawRect,
Expand All @@ -344,7 +344,7 @@ public func recordSnapshot<T: Snapshotable>(named name: String? = nil,
public func recordDeviceAgnosticSnapshot<T: Snapshotable>(named name: String? = nil,
identifier: String? = nil,
usesDrawRect: Bool = false,
shouldIgnoreScale: Bool = false) -> Predicate<T> {
shouldIgnoreScale: Bool = false) -> Nimble.Predicate<T> {

return Predicate { actualExpression in
return recordSnapshot(name, identifier: identifier, isDeviceAgnostic: true, usesDrawRect: usesDrawRect,
Expand Down

0 comments on commit 9e4ab0a

Please sign in to comment.