Skip to content

Commit

Permalink
Adds platform to manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Usbergo committed Feb 3, 2020
1 parent 8806378 commit 10eae1b
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 38 deletions.
5 changes: 4 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import PackageDescription
let package = Package(
name: "Store",
platforms: [
.iOS(.v13)
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
Expand Down
1 change: 0 additions & 1 deletion Sources/Store/Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Combine
import Foundation
import os.log

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public protocol ActionProtocol: Identifiable {
associatedtype AssociatedStoreType: StoreProtocol

Expand Down
7 changes: 2 additions & 5 deletions Sources/Store/Concurreny.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ public func assign<T>(_ value: T, changes: (inout T) -> Void) -> T {

// MARK: @Atomic

@available(iOS 2.0, OSX 10.0, tvOS 9.0, watchOS 2.0, *)
@frozen
@propertyWrapper
@frozen @propertyWrapper
public struct Atomic<T> {
private let _queue = DispatchQueue(label: "Atomic write access queue", attributes: .concurrent)
private var _storage: T
Expand All @@ -44,8 +42,7 @@ public struct Atomic<T> {

// MARK: Spinlock Implementation

@frozen
@usableFromInline
@frozen @usableFromInline
struct SpinLock {
private var _spin = OS_SPINLOCK_INIT
private var _unfair = os_unfair_lock_s()
Expand Down
1 change: 0 additions & 1 deletion Sources/Store/Dispatcher.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Foundation
import os.log

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public final class Dispatcher {
/// The threading strategy that should be used for a given action.
public enum Strategy {
Expand Down
3 changes: 0 additions & 3 deletions Sources/Store/Middleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import os.log

// MARK: - Protocol

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public protocol Middleware: class {
/// A transaction has changed its state.
func onTransactionStateChange(_ transaction: TransactionProtocol)
}

// MARK: - Logger

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public final class LoggerMiddleware: Middleware {
/// Syncronizes the access to the middleware.
private var _lock = SpinLock()
Expand Down Expand Up @@ -57,7 +55,6 @@ public final class LoggerMiddleware: Middleware {

// MARK: - Log Subsystems

@available(iOS 12.0, macOS 10.14, watchOS 3.0, tvOS 13.0, *)
extension OSLog {
public static let primary = OSLog(subsystem: "io.store.StoreService", category: "primary")
public static let diff = OSLog(subsystem: "io.store.StoreService", category: "diff")
Expand Down
2 changes: 0 additions & 2 deletions Sources/Store/Operations.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public final class TransactionOperation<T: TransactionProtocol>: AsyncOperation {
/// The associated transaction.
public let transaction: T
Expand Down Expand Up @@ -37,7 +36,6 @@ public final class TransactionOperation<T: TransactionProtocol>: AsyncOperation
/// Base class for an asynchronous operation.
/// Subclasses are expected to override the 'execute' function and call
/// the function 'finish' when they're done with their task.
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
open class AsyncOperation: Operation {
/// The completion block type for this operation.
public typealias CompletionBlock = () -> Void
Expand Down
2 changes: 0 additions & 2 deletions Sources/Store/SerializableStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import os.log

// MARK: - SerializableStore

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
open class SerializableStore<M: SerializableModelProtocol>: Store<M> {
/// Transaction diffing options.
public enum TransactionDiffStrategy {
Expand Down Expand Up @@ -95,7 +94,6 @@ public protocol SerializableModelProtocol: Codable {
init()
}

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
extension SerializableModelProtocol {
/// Encodes the model into a dictionary.
public func encode() -> EncodedDictionary {
Expand Down
1 change: 0 additions & 1 deletion Sources/Store/Serialization/Signpost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public enum Signpost {

// MARK: - SigPostTransaction

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public final class SignpostTransaction: TransactionProtocol {
/// See `SignpostAction`.
public let actionId: String
Expand Down
9 changes: 2 additions & 7 deletions Sources/Store/Serialization/TransactionDiff.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation
import os.log

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@dynamicMemberLookup public final class Query {
@dynamicMemberLookup
public final class Query {
private var segments: [String] = []
private let transactionDiff: TransactionDiff

Expand All @@ -26,7 +26,6 @@ import os.log
}

/// A collection of changes associated to a transaction.
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@frozen
public struct TransactionDiff {
/// The set of (`path`, `value`) that has been **added**/**removed**/**changed**.
Expand Down Expand Up @@ -75,7 +74,6 @@ public struct TransactionDiff {

/// Represent a property change.
/// A change can be an **addition**, a **removal** or a **value change**.
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public enum PropertyDiff {
case added(new: Codable?)
case changed(old: Codable?, new: Codable?)
Expand Down Expand Up @@ -138,7 +136,6 @@ public enum PropertyDiff {
/// tokens/0: "foo",
/// tokens/1: "bar"
/// } ```
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@inline(__always)
public func flatten(encodedModel: EncodedDictionary) -> FlatEncoding.Dictionary {
var result: FlatEncoding.Dictionary = [:]
Expand Down Expand Up @@ -263,7 +260,6 @@ fileprivate let sharedJSONEncoder = JSONEncoder()

// MARK: - PropertyDiff

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
extension PropertyDiff: CustomStringConvertible, Encodable {

public var description: String {
Expand Down Expand Up @@ -312,7 +308,6 @@ extension PropertyDiff: CustomStringConvertible, Encodable {

// MARK: - Extensions

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
extension Dictionary where Key == FlatEncoding.KeyPath, Value == PropertyDiff {
/// Debug description for a change set.
func storeDebugDecription(short: Bool) -> String {
Expand Down
3 changes: 0 additions & 3 deletions Sources/Store/Store.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Combine
import Foundation

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public protocol AnyStoreProtocol: class {
/// Opaque reference to the model wrapped by this store.
var opaqueModelRef: Any { get }
Expand All @@ -24,7 +23,6 @@ public protocol AnyStoreProtocol: class {
func notifyMiddleware(transaction: TransactionProtocol)
}

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public protocol StoreProtocol: AnyStoreProtocol {
associatedtype ModelType

Expand All @@ -35,7 +33,6 @@ public protocol StoreProtocol: AnyStoreProtocol {
func reduceModel(transaction: TransactionProtocol?, closure: (inout ModelType) -> (Void))
}

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
open class Store<M>: StoreProtocol, ObservableObject {
/// The current state of this store.
@Published public private(set) var model: M
Expand Down
4 changes: 0 additions & 4 deletions Sources/Store/Transaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public enum TransactionState {
}

/// Represents an individual execution of a given action.
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public protocol TransactionProtocol: class, TransactionConvertible {
/// Unique action identifier.
/// An high level description of the action (e.g. `FETCH_USER` or `DELETE_COMMENT`)
Expand Down Expand Up @@ -58,7 +57,6 @@ public protocol TransactionProtocol: class, TransactionConvertible {
func run(handler: Dispatcher.TransactionCompletionHandler)
}

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
extension TransactionProtocol {
public var transactions: [TransactionProtocol] { [self] }

Expand All @@ -70,7 +68,6 @@ extension TransactionProtocol {

// MARK: - Implementation

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public final class Transaction<A: ActionProtocol>: TransactionProtocol, Identifiable {
/// Unique action identifier.
/// An high level description of the action (e.g. `FETCH_USER` or `DELETE_COMMENT`)
Expand Down Expand Up @@ -168,7 +165,6 @@ public final class Transaction<A: ActionProtocol>: TransactionProtocol, Identifi
}
}

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
extension Array where Element: TransactionProtocol {
/// Execute all of the transactions.
public func run(handler: Dispatcher.TransactionCompletionHandler = nil) {
Expand Down
2 changes: 0 additions & 2 deletions Sources/Store/TransactionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Foundation

// MARK: - Context

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@frozen
public struct TransactionContext<S: StoreProtocol, A: ActionProtocol> {
/// The operation that is currently running.
Expand Down Expand Up @@ -50,7 +49,6 @@ public struct TransactionContext<S: StoreProtocol, A: ActionProtocol> {
}
}

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
extension ActionProtocol {
/// Default identifier implementation.
public var id: String {
Expand Down
6 changes: 0 additions & 6 deletions Sources/Store/TransactionDSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import os.log

// MARK: - Function Builder

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@frozen
@_functionBuilder
public struct TransactionSequenceBuilder {
Expand All @@ -24,7 +23,6 @@ public struct TransactionSequenceBuilder {
}
}

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public func RunGroup(@TransactionSequenceBuilder builder: () -> [TransactionProtocol]) {
let transactions = builder()
for transaction in transactions {
Expand All @@ -34,15 +32,13 @@ public func RunGroup(@TransactionSequenceBuilder builder: () -> [TransactionProt

// MARK: - TransactionCollectionConvertible

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public protocol TransactionConvertible {
/// The wrapped transactions.
var transactions: [TransactionProtocol] { get }
}

// MARK: - DSL / Concurrent

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@frozen
public struct Concurrent: TransactionConvertible {
/// The wrapped transactions.
Expand All @@ -59,7 +55,6 @@ public struct Concurrent: TransactionConvertible {

// MARK: - DSL / Throttle

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@frozen
public struct Throttle: TransactionConvertible {
/// The wrapped transactions.
Expand Down Expand Up @@ -92,7 +87,6 @@ public struct Throttle: TransactionConvertible {

// MARK: - DSL / Null

@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@frozen
public struct NullTransaction: TransactionConvertible {
/// The wrapped transactions.
Expand Down

0 comments on commit 10eae1b

Please sign in to comment.