Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Split.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5286,7 +5286,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TVOS_DEPLOYMENT_TARGET = 15.4;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -5352,7 +5352,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TVOS_DEPLOYMENT_TARGET = 15.4;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -5397,7 +5397,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2,3,6";
TVOS_DEPLOYMENT_TARGET = 12.0;
USER_HEADER_SEARCH_PATHS = "";
Expand Down Expand Up @@ -5440,7 +5440,7 @@
SWIFT_INCLUDE_PATHS = "";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
USER_HEADER_SEARCH_PATHS = "";
Expand Down Expand Up @@ -5471,7 +5471,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -5498,7 +5498,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -5583,7 +5583,7 @@
SUPPORTED_PLATFORMS = "watchsimulator watchos";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INCLUDE_PATHS = "";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 7.0;
Expand Down Expand Up @@ -5626,7 +5626,7 @@
SUPPORTED_PLATFORMS = "watchsimulator watchos";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INCLUDE_PATHS = "";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 7.0;
Expand Down
6 changes: 1 addition & 5 deletions Split/Api/DefaultSplitFactoryBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ import Foundation
(Singleton pattern) and reusing it throughout your application.
"""

#if swift(>=6.0)
nonisolated(unsafe) private static let factoryMonitor: FactoryMonitor = { DefaultFactoryMonitor() }()
#else
private static let factoryMonitor: FactoryMonitor = { DefaultFactoryMonitor() }()
#endif
private static let factoryMonitor: FactoryMonitor = { DefaultFactoryMonitor() }()

public override init() {
keyValidator = DefaultKeyValidator()
Expand Down
8 changes: 4 additions & 4 deletions Split/Common/Validators/FactoryMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct WeakFactory {
private(set) weak var factory: SplitFactory?
}

class FactoryRegistry {
final class FactoryRegistry: @unchecked Sendable {

private var queue: DispatchQueue
private var weakFactories: [String: [WeakFactory]]
Expand Down Expand Up @@ -79,16 +79,16 @@ class FactoryRegistry {
}
}

protocol FactoryMonitor {
protocol FactoryMonitor: Sendable {
var allCount: Int { get }
func instanceCount(for apiKey: String) -> Int
func activeCount() -> Int
func register(instance: SplitFactory?, for apiKey: String)
}

class DefaultFactoryMonitor: FactoryMonitor {
final class DefaultFactoryMonitor: FactoryMonitor {

var factoryRegistry: FactoryRegistry
nonisolated(unsafe) var factoryRegistry: FactoryRegistry

var allCount: Int {
return factoryRegistry.count
Expand Down
Loading