-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
3,656 additions
and
935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
disabled_rules: # rule identifiers to exclude from running | ||
- class_delegate_protocol | ||
opt_in_rules: # some rules are only opt-in | ||
- empty_count | ||
- convenience_type | ||
- empty_string | ||
- fatal_error_message | ||
- file_name | ||
- first_where | ||
- modifier_order | ||
- private_action | ||
- private_outlet | ||
- toggle_bool | ||
- unused_private_declaration | ||
- array_init | ||
- block_based_kvo | ||
- closure_end_indentation | ||
- closure_spacing | ||
- collection_alignment | ||
- contains_over_filter_count | ||
- contains_over_filter_is_empty | ||
- contains_over_first_not_nil | ||
- contains_over_range_nil_comparison | ||
- discouraged_optional_boolean | ||
- discouraged_optional_collection | ||
- empty_collection_literal | ||
included: # paths to include during linting. `--path` is ignored if present. | ||
- Sources | ||
- Tests | ||
excluded: # paths to ignore during linting. Takes precedence over `included`. | ||
- Carthage | ||
- Pods | ||
analyzer_rules: # Rules run by `swiftlint analyze` (experimental) | ||
- explicit_self | ||
type_name: | ||
min_length: 4 # only warning | ||
max_length: # warning and error | ||
warning: 40 | ||
error: 50 | ||
identifier_name: | ||
excluded: # excluded via string array | ||
- id | ||
- URL | ||
reporter: "xcode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# AsyncOperation | ||
|
||
Code taken from https://medium.com/flawless-app-stories/parallel-programming-with-swift-operations-54cbefaf3cb0 | ||
Overide the exec method in order to use. | ||
|
||
``` swift | ||
open class AsyncOperation: Operation | ||
``` | ||
|
||
## Inheritance | ||
|
||
`Operation` | ||
|
||
## Properties | ||
|
||
### `isFinishedEvent` | ||
|
||
``` swift | ||
var isFinishedEvent | ||
``` | ||
|
||
### `isExecutingEvent` | ||
|
||
``` swift | ||
var isExecutingEvent | ||
``` | ||
|
||
### `isAsynchronous` | ||
|
||
``` swift | ||
var isAsynchronous: Bool | ||
``` | ||
|
||
### `isFinished` | ||
|
||
``` swift | ||
var isFinished: Bool | ||
``` | ||
|
||
### `isExecuting` | ||
|
||
``` swift | ||
var isExecuting: Bool | ||
``` | ||
|
||
## Methods | ||
|
||
### `execute()` | ||
|
||
``` swift | ||
open func execute() | ||
``` | ||
|
||
### `start()` | ||
|
||
``` swift | ||
override open func start() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# BindingCommand | ||
|
||
Abstract: | ||
Is used to give buttons and inputs actions that they will incur. Unlike the Command, this class is static. | ||
|
||
``` swift | ||
public final class BindingCommand | ||
``` | ||
|
||
## Initializers | ||
|
||
### `init(exec:undo:)` | ||
|
||
Initializes the Command with an executable closure and a closure to undo it. | ||
|
||
``` swift | ||
public init(exec: @escaping () -> Bool, undo: (() -> Bool)? = nil) | ||
``` | ||
|
||
#### Parameters | ||
|
||
- exec: The closure to be used for execution | ||
- undo: The closue to be used to undo the state changes caused by the exec closure | ||
|
||
## Properties | ||
|
||
### `name` | ||
|
||
The name of the command | ||
|
||
``` swift | ||
var name: String? | ||
``` | ||
|
||
## Methods | ||
|
||
### `execute()` | ||
|
||
Executes the command if actor is non-nil. | ||
|
||
``` swift | ||
@discardableResult public func execute() -> Bool | ||
``` | ||
|
||
#### Returns | ||
|
||
a discardable `Bool` describing if the action was successful | ||
|
||
### `undo()` | ||
|
||
Does the undo variant of the command if undo is set with the last value set. | ||
|
||
``` swift | ||
@discardableResult public func undo() -> Bool | ||
``` | ||
|
||
#### Returns | ||
|
||
a discardable `Bool` describing if the action was successful |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# BindingCommandResponder | ||
|
||
Abstract: | ||
Used for a command responder chain in order to allow responsibility to be passed | ||
but retain a strong reference to all captured types. | ||
|
||
``` swift | ||
public protocol BindingCommandResponder | ||
``` | ||
|
||
## Requirements | ||
|
||
### recieve(\_:sender:) | ||
|
||
Called on the next responder in the chain. | ||
|
||
``` swift | ||
func recieve(_ command: BindingCommand, sender: Any?) | ||
``` | ||
|
||
#### Parameters | ||
|
||
- command: The command to be run by the responder or to be passed to another responder in the chain | ||
- sender: The sender of the command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Command | ||
|
||
Abstract: | ||
Is used to give buttons and inputs actions that they will incur. | ||
This is helpful if you dont want to create a new command for every incurrence of the command with a different value | ||
|
||
``` swift | ||
public final class Command<ActorType: AnyObject, ValueType: Any> | ||
``` | ||
|
||
## Initializers | ||
|
||
### `init(actor:value:exec:)` | ||
|
||
Initializes the Command with an executable closure and the required default values to run the command | ||
|
||
``` swift | ||
public convenience init(actor: ActorType?, value: ValueType?, exec: @escaping (ActorType, ValueType?) -> Bool) | ||
``` | ||
|
||
### `init(actor:value:exec:undo:)` | ||
|
||
Initializes the Command with an executable closure and an undo closure | ||
|
||
``` swift | ||
public required init(actor: ActorType?, value: ValueType?, exec: @escaping (ActorType, ValueType?) -> Bool, undo: ((ActorType, ValueType?) -> Bool)?) | ||
``` | ||
|
||
## Properties | ||
|
||
### `undoCommand` | ||
|
||
The command that will undo the execCommand | ||
|
||
``` swift | ||
let undoCommand: ((ActorType, ValueType?) -> Bool)? | ||
``` | ||
|
||
### `value` | ||
|
||
This is the value that will be used in during the exec or undo commands | ||
|
||
``` swift | ||
var value: ValueType? | ||
``` | ||
|
||
### `actor` | ||
|
||
This is the current actor the comamnds will act upon | ||
|
||
``` swift | ||
var actor: ActorType? | ||
``` | ||
|
||
## Methods | ||
|
||
### `execute(with:)` | ||
|
||
Executes the command with the new value if actor is non-nil. | ||
|
||
``` swift | ||
@discardableResult public func execute(with newValue: ValueType) -> Bool | ||
``` | ||
|
||
#### Returns | ||
|
||
a discardable `Bool` describing if the action was successful | ||
|
||
### `execute()` | ||
|
||
Executes the command if actor is non-nil. | ||
|
||
``` swift | ||
@discardableResult public func execute() -> Bool | ||
``` | ||
|
||
#### Returns | ||
|
||
a discardable `Bool` describing if the action was successful | ||
|
||
### `undo()` | ||
|
||
Does the undo variant of the command if undo is set with the last value set. | ||
|
||
``` swift | ||
@discardableResult public func undo() -> Bool | ||
``` | ||
|
||
#### Returns | ||
|
||
a discardable `Bool` describing if the action was successful | ||
|
||
### `getUndo()` | ||
|
||
Gets a closure that can undo the last exec comamnd. | ||
This can be helpful in queing up a list of commands that can undo previous actions. | ||
|
||
``` swift | ||
@discardableResult public func getUndo() -> (() -> Bool)? | ||
``` | ||
|
||
#### Returns | ||
|
||
a closure that returns bool for wether it was successful or not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Disposable | ||
|
||
Lets you dispose of a connected type. | ||
|
||
``` swift | ||
public protocol Disposable: AnyObject | ||
``` | ||
|
||
## Inheritance | ||
|
||
`AnyObject` | ||
|
||
## Requirements | ||
|
||
### dispose() | ||
|
||
Tells the object to dispose itself | ||
|
||
``` swift | ||
func dispose() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# DisposeContainer | ||
|
||
Automatically disposes of a event upon deinit | ||
|
||
``` swift | ||
public class DisposeContainer: Disposable | ||
``` | ||
|
||
## Inheritance | ||
|
||
[`Disposable`](./Disposable.md) | ||
|
||
## Initializers | ||
|
||
### `init(toBeDisposed:)` | ||
|
||
``` swift | ||
public init(toBeDisposed: Disposable) | ||
``` | ||
|
||
#### Parameters | ||
|
||
- toBeDisposed: The object that is to have its dispose called upon deinit | ||
|
||
## Methods | ||
|
||
### `removeDisposableFromContainer()` | ||
|
||
Removes the responsibility of disposing the related class from the container | ||
|
||
``` swift | ||
public func removeDisposableFromContainer() -> Disposable? | ||
``` | ||
|
||
### `dispose()` | ||
|
||
Manually disposes of the contained disposable | ||
|
||
``` swift | ||
public func dispose() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# EquivalentIntegerSize | ||
|
||
``` swift | ||
public protocol EquivalentIntegerSize: BinaryFloatingPoint | ||
``` | ||
|
||
## Inheritance | ||
|
||
`BinaryFloatingPoint` |
Oops, something went wrong.