Skip to content

Commit

Permalink
fix Swift 5.9 features
Browse files Browse the repository at this point in the history
  • Loading branch information
NikSativa committed Sep 17, 2024
1 parent dc5d87f commit 4d2e73b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/Helpers/Image+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ public extension Image {
}

public extension Image.spry {
#if os(macOS)
#if os(macOS) && swift(>=5.9)
nonisolated(unsafe) static let testImage: Image = .init(systemSymbolName: "circle", accessibilityDescription: nil)!
nonisolated(unsafe) static let testImage1: Image = .init(systemSymbolName: "square", accessibilityDescription: nil)!
nonisolated(unsafe) static let testImage2: Image = .init(systemSymbolName: "diamond", accessibilityDescription: nil)!
nonisolated(unsafe) static let testImage3: Image = .init(systemSymbolName: "octagon", accessibilityDescription: nil)!
nonisolated(unsafe) static let testImage4: Image = .init(systemSymbolName: "oval", accessibilityDescription: nil)!
#elseif os(macOS)
static let testImage: Image = .init(systemSymbolName: "circle", accessibilityDescription: nil)!
static let testImage1: Image = .init(systemSymbolName: "square", accessibilityDescription: nil)!
static let testImage2: Image = .init(systemSymbolName: "diamond", accessibilityDescription: nil)!
static let testImage3: Image = .init(systemSymbolName: "octagon", accessibilityDescription: nil)!
static let testImage4: Image = .init(systemSymbolName: "oval", accessibilityDescription: nil)!
#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
static let testImage: Image = Self.image(withColor: .blue)
static let testImage1: Image = Self.image(withColor: .green)
Expand Down
4 changes: 4 additions & 0 deletions Source/Spy/SpyableImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import Foundation
/// A global NSMapTable to hold onto calls for types conforming to Spyable. This map table has "weak to strong objects" options.
///
/// - Important: Do NOT use this object.
#if swift(>=5.9)
private nonisolated(unsafe) var callsMapTable: NSMapTable<AnyObject, SpryDictionary<RecordedCall>> = NSMapTable.weakToStrongObjects()
#else
private var callsMapTable: NSMapTable<AnyObject, SpryDictionary<RecordedCall>> = NSMapTable.weakToStrongObjects()
#endif

public extension Spyable {
// MARK: Instance
Expand Down
4 changes: 4 additions & 0 deletions Source/Stub/StubbableImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import Foundation
/// A global NSMapTable to hold onto stubs for types conforming to Stubbable. This map table has "weak to strong objects" options.
///
/// - Important: Do NOT use this object.
#if swift(>=5.9)
private nonisolated(unsafe) var stubsMapTable: NSMapTable<AnyObject, SpryDictionary<StubInfo>> = NSMapTable.weakToStrongObjects()
#else
private var stubsMapTable: NSMapTable<AnyObject, SpryDictionary<StubInfo>> = NSMapTable.weakToStrongObjects()
#endif

/// Used to determine if a fallback was given in the event of that no stub is found.
internal enum Fallback<T> {
Expand Down

0 comments on commit 4d2e73b

Please sign in to comment.