diff --git a/Sources/StreamAttachments/Info.plist b/Sources/StreamAttachments/Info.plist index 1a003f9..159225b 100644 --- a/Sources/StreamAttachments/Info.plist +++ b/Sources/StreamAttachments/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 0.4.0 + 0.4.1 CFBundleVersion $(CURRENT_PROJECT_VERSION) diff --git a/Sources/StreamCore/Utils/Atomic.swift b/Sources/StreamCore/Concurrency/Atomic.swift similarity index 100% rename from Sources/StreamCore/Utils/Atomic.swift rename to Sources/StreamCore/Concurrency/Atomic.swift diff --git a/Sources/StreamCore/Utils/StreamConcurrency.swift b/Sources/StreamCore/Concurrency/StreamConcurrency.swift similarity index 100% rename from Sources/StreamCore/Utils/StreamConcurrency.swift rename to Sources/StreamCore/Concurrency/StreamConcurrency.swift diff --git a/Sources/StreamCore/Info.plist b/Sources/StreamCore/Info.plist index 1a003f9..159225b 100644 --- a/Sources/StreamCore/Info.plist +++ b/Sources/StreamCore/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 0.4.0 + 0.4.1 CFBundleVersion $(CURRENT_PROJECT_VERSION) diff --git a/Sources/StreamCore/Utils/Data+Gzip.swift b/Sources/StreamCore/Utils/Data+Gzip.swift index 7b834fa..007b19b 100644 --- a/Sources/StreamCore/Utils/Data+Gzip.swift +++ b/Sources/StreamCore/Utils/Data+Gzip.swift @@ -35,7 +35,7 @@ extension Data { /// /// - Returns: Gzip-compressed `Data` instance. /// - Throws: `GzipError` - func gzipped() throws -> Data { + public func gzipped() throws -> Data { guard !isEmpty else { return Data() } diff --git a/Sources/StreamCore/Utils/HTTPUtils.swift b/Sources/StreamCore/Utils/HTTPUtils.swift index cb3a3d1..0e988e3 100644 --- a/Sources/StreamCore/Utils/HTTPUtils.swift +++ b/Sources/StreamCore/Utils/HTTPUtils.swift @@ -5,7 +5,7 @@ import Foundation extension URLRequest { - var queryItems: [URLQueryItem] { + public var queryItems: [URLQueryItem] { if let url, let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), let queryItems = urlComponents.queryItems { @@ -16,7 +16,7 @@ extension URLRequest { } extension Array where Element == URLQueryItem { - var prettyPrinted: String { + public var prettyPrinted: String { var message = "" forEach { item in diff --git a/Sources/StreamCore/Utils/RawJSON.swift b/Sources/StreamCore/Utils/RawJSON.swift index edd8bfb..7f9a367 100644 --- a/Sources/StreamCore/Utils/RawJSON.swift +++ b/Sources/StreamCore/Utils/RawJSON.swift @@ -15,7 +15,7 @@ public indirect enum RawJSON: Codable, Hashable, Sendable { case array([RawJSON]) case `nil` - static let double = number + public static let double = number public init(from decoder: Decoder) throws { let singleValueContainer = try decoder.singleValueContainer() @@ -294,7 +294,7 @@ extension RawJSON { /// let price = customData["flight"]?["price"].numberValue /// let destination = customData["flight"]?["destination"].stringValue /// ``` - subscript(key: String) -> RawJSON? { + public subscript(key: String) -> RawJSON? { get { guard case let .dictionary(dict) = self else { return nil @@ -320,7 +320,7 @@ extension RawJSON { /// let customData = message.customData /// let secondFlightPrice = customData["flights"]?[1]?["price"] ?? 0 /// ``` - subscript(index: Int) -> RawJSON? { + public subscript(index: Int) -> RawJSON? { get { guard case let .array(array) = self else { return nil diff --git a/Sources/StreamCore/Utils/StreamRuntimeCheck.swift b/Sources/StreamCore/Utils/StreamRuntimeCheck.swift index 7ad1009..0e48e83 100644 --- a/Sources/StreamCore/Utils/StreamRuntimeCheck.swift +++ b/Sources/StreamCore/Utils/StreamRuntimeCheck.swift @@ -9,26 +9,4 @@ public enum StreamRuntimeCheck { /// /// When set to false, a message will be logged on console, but the assertion will not be thrown. public nonisolated(unsafe) static var assertionsEnabled = false - - /// For *internal use* only - /// - /// Established the maximum depth of relationships to fetch when performing a mapping - /// - /// Eg. - /// Relationship: Message ---> QuotedMessage ---> QuotedMessage ---X--- NIL - /// Relationship: Channel ---> Message ---> QuotedMessage ---X--- NIL - /// Depth: 0 1 2 3 - nonisolated(unsafe) static var _backgroundMappingRelationshipsMaxDepth = 2 - - /// For *internal use* only - /// - /// Returns true if the maximum depth of relationships to fetch when performing a mapping is not yet met - static func _canFetchRelationship(currentDepth: Int) -> Bool { - currentDepth <= _backgroundMappingRelationshipsMaxDepth - } - - /// For *internal use* only - /// - /// Core Data prefetches data used for creating immutable model objects (faulting is disabled). - public nonisolated(unsafe) static var _isDatabasePrefetchingEnabled = false } diff --git a/Sources/StreamCore/Utils/StringExtensions.swift b/Sources/StreamCore/Utils/StringExtensions.swift index fd71356..37d4d0c 100644 --- a/Sources/StreamCore/Utils/StringExtensions.swift +++ b/Sources/StreamCore/Utils/StringExtensions.swift @@ -53,7 +53,7 @@ extension String { } extension StringProtocol { - func ranges(of string: S, options: String.CompareOptions = []) -> [Range] { + public func ranges(of string: S, options: String.CompareOptions = []) -> [Range] { var result: [Range] = [] var startIndex = startIndex while startIndex < endIndex, let range = self[startIndex...].range(of: string, options: options) { diff --git a/Sources/StreamCore/Utils/SystemEnvironment+Version.swift b/Sources/StreamCore/Utils/SystemEnvironment+Version.swift index 3ac3fa3..5fc7443 100644 --- a/Sources/StreamCore/Utils/SystemEnvironment+Version.swift +++ b/Sources/StreamCore/Utils/SystemEnvironment+Version.swift @@ -6,5 +6,5 @@ import Foundation enum SystemEnvironment { /// A Stream Core version. - public static let version: String = "0.4.0" + public static let version: String = "0.4.1" } diff --git a/Sources/StreamCore/Utils/Timers.swift b/Sources/StreamCore/Utils/Timers.swift index b604ca0..2526b63 100644 --- a/Sources/StreamCore/Utils/Timers.swift +++ b/Sources/StreamCore/Utils/Timers.swift @@ -55,6 +55,7 @@ public protocol TimerControl { } extension DispatchWorkItem: TimerControl {} +extension DispatchWorkItem: @retroactive @unchecked Sendable {} /// Default real-world implementations of timers. public struct DefaultTimer: StreamTimer { @@ -116,7 +117,11 @@ private class RepeatingTimer: RepeatingTimerControl, @unchecked Sendable { private let queue = DispatchQueue(label: "io.getstream.repeating-timer") private var state: State = .suspended + #if compiler(>=6.1) private let timer: DispatchSourceTimer + #else + private nonisolated(unsafe) let timer: DispatchSourceTimer + #endif init(timeInterval: TimeInterval, queue: DispatchQueue, onFire: @escaping () -> Void) { timer = DispatchSource.makeTimerSource(queue: queue) diff --git a/Sources/StreamCoreUI/Info.plist b/Sources/StreamCoreUI/Info.plist index 1a003f9..159225b 100644 --- a/Sources/StreamCoreUI/Info.plist +++ b/Sources/StreamCoreUI/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 0.4.0 + 0.4.1 CFBundleVersion $(CURRENT_PROJECT_VERSION)