Skip to content

Commit

Permalink
significant api changes for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-zethraeus committed Mar 17, 2023
1 parent 64b8a15 commit 3d411d5
Show file tree
Hide file tree
Showing 58 changed files with 1,304 additions and 465 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.7
5.8
98 changes: 65 additions & 33 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -1,83 +1,115 @@
--exclude Sources/AnyCodable

# options
--swiftversion 5.7
--self remove # redundantSelf
--importgrouping testable-bottom # sortedImports
--commas always # trailingCommas
--trimwhitespace always # trailingSpace
--indent 2 #indent
--ifdef no-indent #indent
--indentstrings true #indent
--wraparguments before-first # wrapArguments
--wrapparameters before-first # wrapArguments
--wrapcollections before-first # wrapArguments
--wrapconditions before-first # wrapArguments
--wrapreturntype if-multiline #wrapArguments
--closingparen balanced # wrapArguments
--wraptypealiases before-first # wrapArguments
--funcattributes prev-line # wrapAttributes
--typeattributes prev-line # wrapAttributes
--wrapternary before-operators # wrap
--structthreshold 30 # organizeDeclarations
--enumthreshold 30 # organizeDeclarations
--organizetypes class,struct,enum,extension,actor # organizeDeclarations
--markcategories false #organizeDeclarations
--extensionacl on-declarations # extensionAccessControl
--patternlet inline # hoistPatternLet
--redundanttype inferred # redundantType
--typeblanklines preserve # blankLinesAtStartOfScope, blankLinesAtEndOfScope
--emptybraces no-space # emptyBraces
--maxwidth 120 # wrap

# rules
--rules acronyms
--rules andOperator
--rules anyObjectProtocol
--rules blankLinesAtEndOfScope
--rules blankLinesAtStartOfScope
--rules blankLinesBetweenImports
--rules blankLinesBetweenScopes
--rules blockComments
--rules braces
--rules consecutiveBlankLines
--rules consecutiveSpaces
--rules docComments
--rules duplicateImports
--rules elseOnSameLine
--rules emptyBraces
--rules enumNamespaces
--rules extensionAccessControl
--rules fileHeader
--rules genericExtensions
--rules hoistPatternLet
--rules indent
--rules initCoderUnavailable
--rules isEmpty
--rules markTypes
--rules modifierOrder
--rules numberFormatting
--rules opaqueGenericParameters
--rules organizeDeclarations
--rules preferKeyPath
--rules redundantBackticks
--rules redundantBreak
--rules redundantClosure
--rules redundantExtensionACL
--rules redundantFileprivate
--rules redundantGet
--rules redundantInit
--rules redundantLet
--rules redundantNilInit
--rules redundantObjc
--rules redundantParens
--rules redundantPattern
--rules redundantRawValues
--rules redundantReturn
--rules redundantSelf
--rules redundantType
--rules redundantVoidReturnType
--rules semicolons
--rules sortDeclarations
--rules sortedImports
--rules sortedSwitchCases
--rules spaceAroundBraces
--rules spaceAroundComments
--rules spaceAroundGenerics
--rules spaceAroundOperators
--rules spaceAroundParens
--rules spaceInsideBraces
--rules spaceInsideBrackets
--rules spaceInsideComments
--rules spaceInsideGenerics
--rules spaceInsideParens
--rules strongifiedSelf
--rules todos
--rules trailingClosures
--rules trailingCommas
--rules trailingSpace
--rules typeSugar
--rules unusedArguments
--rules void
--rules wrap
--rules wrapArguments
--rules wrapAttributes
--rules wrapConditionalBodies
--rules wrapEnumCases
--rules wrapMultilineStatementBraces
--rules wrapSingleLineComments
--rules wrapSwitchCases

--acronyms ID,URL,UUID # acronyms
--closingparen balanced # wrapArguments
--closurevoid remove # redundantVoidReturnType
--commas always # trailingCommas
--decimalgrouping 3,6 # numberFormatting
--emptybraces spaced # emptyBraces
--enumthreshold 30 # organizeDeclarations
--extensionacl on-declarations # extensionAccessControl
--funcattributes prev-line # wrapAttributes
--header strip # fileHeader
--ifdef noindent #indent
--importgrouping testable-bottom # sortedImports
--indent 2 #indent
--indentcase false #indent
--indentstrings true #indent
--lifecycle # organizeDeclarations
--markcategories true #organizeDeclarations
--maxwidth 100 # wrap
--modifierorder public,private(set),private,internal,final,override,convenience # modifierOrder
--operatorfunc spaced # spaceAroundOperators
--organizetypes class,struct,enum,extension,actor # organizeDeclarations
--patternlet inline # hoistPatternLet
--ranges spaced # spaceAroundOperators
--redundanttype infer-locals-only # redundantType
--self init-only # redundantSelf
--structthreshold 30 # organizeDeclarations
--tabwidth 2 # indent
--trimwhitespace always # trailingSpace
--typeattributes prev-line # wrapAttributes
--typeblanklines preserve # blankLinesAtStartOfScope, blankLinesAtEndOfScope
--varattributes same-line # wrapAttributes
--wraparguments before-first # wrapArguments
--wrapcollections before-first # wrapArguments
--wrapconditions before-first # wrapArguments
--wrapparameters before-first # wrapArguments
--wrapreturntype if-multiline # wrapArguments
--wrapternary before-operators # wrapAttributes
--wraptypealiases before-first # wrapArguments
18 changes: 0 additions & 18 deletions .swiftlint
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,3 @@ only_rules:
- unused_optional_binding
- vertical_whitespace
- void_return
- custom_rules

excluded:
- Carthage
- Pods
- ./**/.build

colon:
apply_to_dictionaries: false

indentation: 2

custom_rules:
no_objcMembers:
name: "@objcMembers"
regex: "@objcMembers"
message: "Explicitly use @objc on each member you want to expose to Objective-C"
severity: error
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/GoodHatsLLC/Disposable.git",
"state" : {
"revision" : "993f5c38c28760fd09e177ed117d7c3577ca919f",
"version" : "0.6.2"
"revision" : "ad15a072fa7cfb7492dad32e55c5a7ecbfc1f38b",
"version" : "0.7.0"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/GoodHatsLLC/Disposable.git", from: .init(0, 6, 1)),
.package(url: "https://github.com/GoodHatsLLC/Disposable.git", from: .init(0, 7, 0)),
],
targets: [
.target(
Expand Down
47 changes: 0 additions & 47 deletions Sources/Emitter/AsyncValues/AsyncThrowingValue.swift

This file was deleted.

35 changes: 0 additions & 35 deletions Sources/Emitter/AsyncValues/AsyncValue.swift

This file was deleted.

41 changes: 41 additions & 0 deletions Sources/Emitter/Bridging/AsyncToEmitterBridge.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

extension Emitter {
public static func bridge<Seq: AsyncSequence>(_ sequence: Seq) -> some Emitting<Seq.Element> {
AsyncToEmitterBridge(sequence)
}
}

// MARK: - AsyncToEmitterBridge

public struct AsyncToEmitterBridge<Seq: AsyncSequence>: Emitting, @unchecked Sendable {
public typealias Output = Seq.Element

public func subscribe<S: Subscriber>(_ subscriber: S) -> AnyDisposable
where Seq.Element == S.Value
{
let stage = DisposableStage()
Emitter
.create(Output.self) { emit in
AnyDisposable(Task {
do {
for try await value in seq {
emit(.value(value))
}
emit(.finished)
} catch {
emit(.failed(error))
}
})
.stage(on: stage)
}
.subscribe(subscriber)
.stage(on: stage)
return stage.erase()
}

private let seq: Seq

public init(_ sequence: Seq) where Output == Seq.Element {
self.seq = sequence
}
}
26 changes: 0 additions & 26 deletions Sources/Emitter/Bridging/AsyncValues.swift

This file was deleted.

Loading

0 comments on commit 3d411d5

Please sign in to comment.