Skip to content

Commit

Permalink
Update for Swift Package Index
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanekay committed Oct 20, 2024
1 parent 96ebcc2 commit 87a997b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
14 changes: 14 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pins" : [
{
"identity" : "identity",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Fleuronic/Identity",
"state" : {
"branch" : "master",
"revision" : "511c8584d7c0bed3da607156a4d643fd44ca4368"
}
}
],
"version" : 2
}
4 changes: 4 additions & 0 deletions Sources/Catena/Fields/IDFields.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright © Fleuronic LLC. All rights reserved.

#if swift(<5.9)
import protocol Identity.Identifiable
#else
public import protocol Identity.Identifiable
#endif

public struct IDFields<Model: Identifiable & Sendable>: Fields, Hashable where Model.ID: Hashable & Sendable, Model.RawIdentifier: Sendable {
public let id: Model.ID
Expand Down
4 changes: 4 additions & 0 deletions Sources/Catena/Fields/IDListFields.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright © Fleuronic LLC. All rights reserved.

#if swift(<5.9)
import protocol Identity.Identifiable
#else
public import protocol Identity.Identifiable
#endif

public struct IDListFields<Model: Identifiable & Sendable>: Fields, Sendable where Model.ID: Sendable {
public let ids: [Model.ID]
Expand Down
8 changes: 4 additions & 4 deletions Sources/Catena/Result.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
public extension Result {
func map<NewSuccess>(_ transform: (Success) async -> NewSuccess) async -> Result<NewSuccess, Failure> {
switch self {
case let .success(value): .success(await transform(value))
case let .failure(error): .failure(error)
case let .success(value): return .success(await transform(value))
case let .failure(error): return .failure(error)
}
}

func flatMap<NewSuccess>(_ transform: (Success) async -> Result<NewSuccess, Failure>) async -> Result<NewSuccess, Failure> {
switch self {
case let .success(value): await transform(value)
case let .failure(error): .failure(error)
case let .success(value): return await transform(value)
case let .failure(error): return .failure(error)
}
}
}
6 changes: 3 additions & 3 deletions Sources/Catena/Undocumented.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public enum Undocumented<Field: Sendable>: Sendable {
public extension Undocumented {
var precheckedValue: Field {
switch self {
case let .present(field): field
case let .present(field): return field
default: fatalError()
}
}

var isMissing: Bool {
switch self {
case .missing: true
default: false
case .missing: return true
default: return false
}
}
}
Expand Down

0 comments on commit 87a997b

Please sign in to comment.