Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Linting

on:
pull_request:
branches: [ main ]
branches: [main]

jobs:
check-changes:
Expand All @@ -24,9 +24,11 @@ jobs:

Lint:
runs-on: ubuntu-latest
container:
image: swift:6.2-jammy
if: ${{ github.event_name == 'push' || needs.check-changes.outputs.changed == 'true' }}
needs: check-changes
steps:
- uses: actions/checkout@v3
- name: "🧹 Lint changed files"
run: make lint
run: swift package plugin --allow-writing-to-package-directory swiftformat . --lint
2 changes: 1 addition & 1 deletion .github/workflows/linux-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
swift: [ "swift:6.1", "swift:6.2", "swift:6.3" ]
swift: [ "swift:6.2", "swift:6.3" ]
os: [ amazonlinux2, jammy, rhel-ubi9, noble ]

container:
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
/Packages
/*.xcodeproj
xcuserdata/
/Release
/Package.resolved
/Release
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.10
6.2
2 changes: 1 addition & 1 deletion Examples/Examples/Dependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Vexil
struct Dependencies {
var flags = FlagPole(
hoist: FeatureFlags.self,
sources: FlagPole<FeatureFlags>.defaultSources + [RemoteFlags.values]
sources: FlagPole<FeatureFlags>.defaultSources + [RemoteFlags.values],
)

@TaskLocal
Expand Down
4 changes: 3 additions & 1 deletion Examples/Examples/DoubleAndBooleanControlStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ struct DoubleAndBooleanControlStyle: FlagControlStyle {

extension FlagControlStyle where Self == DoubleAndBooleanControlStyle {

static var doubleAndBoolean: Self { Self() }
static var doubleAndBoolean: Self {
Self()
}

}
2 changes: 1 addition & 1 deletion Examples/Examples/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct RootView: View {
}
.flagPole(
Dependencies.current.flags,
editableSource: Dependencies.current.flags._sources.first
editableSource: Dependencies.current.flags._sources.first,
)
.flagControlStyle(.doubleAndBoolean)

Expand Down
2 changes: 1 addition & 1 deletion Examples/ExamplesTests/ExamplesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Testing
struct ExamplesTests {

@Test
func example() async throws {
func example() {
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ let package = Package(
name: "",
products: [],
dependencies: [],
targets: []
targets: [],
)
42 changes: 42 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:6.1
// swift-tools-version:6.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import CompilerPluginSupport
Expand All @@ -20,7 +20,7 @@ let package = Package(

dependencies: [
.package(url: "https://github.com/apple/swift-async-algorithms.git", from: "1.0.0"),
.package(url: "https://github.com/nicklockwood/SwiftFormat.git", from: "0.54.1"),
.package(url: "https://github.com/nicklockwood/SwiftFormat.git", from: "0.60.1"),
.package(url: "https://github.com/swiftlang/swift-syntax.git", "600.0.0" ..< "603.0.0"),
],

Expand All @@ -33,13 +33,13 @@ let package = Package(
dependencies: [
.target(name: "VexilMacros"),
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
]
],
),
.testTarget(
name: "VexilTests",
dependencies: [
.target(name: "Vexil"),
]
],
),

// Macros
Expand All @@ -51,15 +51,15 @@ let package = Package(
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
]
],
),


],

swiftLanguageModes: [
.v6,
]
],

)

Expand All @@ -70,16 +70,16 @@ let package = Package(
// Vexillographer is not supported on Linux

package.products.append(
.library(name: "Vexillographer", targets: [ "Vexillographer" ])
.library(name: "Vexillographer", targets: [ "Vexillographer" ]),
)

package.targets.append(
.target(
name: "Vexillographer",
dependencies: [
.target(name: "Vexil"),
]
)
],
),
)

// MARK: - Macro Testing
Expand All @@ -91,8 +91,8 @@ package.targets.append(
dependencies: [
.target(name: "VexilMacros"),
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
]
)
],
),
)

#endif
2 changes: 1 addition & 1 deletion Sources/Vexil/Container.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
names: named(_flagKeyPath), named(_flagLookup), named(init(_flagKeyPath:_flagLookup:))
)
public macro FlagContainer(
generateEquatable: any ExpressibleByBooleanLiteral = true
generateEquatable: any ExpressibleByBooleanLiteral = true,
) = #externalMacro(module: "VexilMacros", type: "FlagContainerMacro")

public protocol FlagContainer: Sendable {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Vexil/Flag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@attached(accessor)
@attached(peer, names: prefixed(`$`))
public macro Flag(
_ description: StaticString
_ description: StaticString,
) = #externalMacro(module: "VexilMacros", type: "FlagMacro")

/// Creates a flag with the specified configuration.
Expand Down Expand Up @@ -91,5 +91,5 @@ public macro Flag(
name: StaticString? = nil,
keyStrategy: VexilConfiguration.FlagKeyStrategy = .default,
description: StaticString,
display: FlagDisplayOption = .default
display: FlagDisplayOption = .default,
) = #externalMacro(module: "VexilMacros", type: "FlagMacro")
6 changes: 3 additions & 3 deletions Sources/Vexil/Group.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@attached(peer, names: prefixed(`$`))
public macro FlagGroup(
_ description: StaticString,
display: FlagGroupDisplayOption = .navigation
display: FlagGroupDisplayOption = .navigation,
) = #externalMacro(module: "VexilMacros", type: "FlagGroupMacro")

/// Creates a FlagGroup with the given parameters.
Expand Down Expand Up @@ -98,7 +98,7 @@ public macro FlagGroup(
@attached(accessor)
@attached(peer, names: prefixed(`$`))
public macro FlagGroup(
_ description: StaticString
_ description: StaticString,
) = #externalMacro(module: "VexilMacros", type: "FlagGroupMacro")

@attached(accessor)
Expand All @@ -107,5 +107,5 @@ public macro FlagGroup(
name: StaticString? = nil,
keyStrategy: VexilConfiguration.GroupKeyStrategy = .default,
description: StaticString,
display: FlagGroupDisplayOption = .navigation
display: FlagGroupDisplayOption = .navigation,
) = #externalMacro(module: "VexilMacros", type: "FlagGroupMacro")
8 changes: 4 additions & 4 deletions Sources/Vexil/KeyPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct FlagKeyPath: Hashable, Sendable {
_ keyPath: [Key],
separator: String = ".",
strategy: VexilConfiguration.CodingKeyStrategy = .default,
key: String
key: String,
) {
self.keyPath = keyPath
self.separator = separator
Expand All @@ -48,7 +48,7 @@ public struct FlagKeyPath: Hashable, Sendable {
public init(
_ keyPath: [Key],
separator: String = ".",
strategy: VexilConfiguration.CodingKeyStrategy = .default
strategy: VexilConfiguration.CodingKeyStrategy = .default,
) {
self.keyPath = keyPath
self.separator = separator
Expand Down Expand Up @@ -89,15 +89,15 @@ public struct FlagKeyPath: Hashable, Sendable {
case .root:
self.key // mostly a noop
}
}()
}(),
)
}

static func root(separator: String, strategy: VexilConfiguration.CodingKeyStrategy) -> FlagKeyPath {
FlagKeyPath(
[ .root ],
separator: separator,
strategy: strategy
strategy: strategy,
)
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Vexil/Lookup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation
public protocol FlagLookup: Sendable {

@inlinable
func value<Value>(for keyPath: FlagKeyPath) -> Value? where Value: FlagValue
func value<Value: FlagValue>(for keyPath: FlagKeyPath) -> Value?

var changes: FlagChangeStream { get }

Expand All @@ -35,7 +35,7 @@ extension FlagPole: FlagLookup {
/// that key, returning the first non-nil value it finds.
///
@inlinable
public func value<Value>(for keyPath: FlagKeyPath) -> Value? where Value: FlagValue {
public func value<Value: FlagValue>(for keyPath: FlagKeyPath) -> Value? {
for source in _sources {
if let value: Value = source.flagValue(key: keyPath.key) {
return value
Expand Down
8 changes: 4 additions & 4 deletions Sources/Vexil/Observability/FlagGroupWigwag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Combine
///
/// For more information on Wigwags see https://en.wikipedia.org/wiki/Wigwag_(flag_signals)
///
public struct FlagGroupWigwag<Output>: Sendable where Output: FlagContainer {
public struct FlagGroupWigwag<Output: FlagContainer>: Sendable {

// MARK: - Properties

Expand Down Expand Up @@ -58,7 +58,7 @@ public struct FlagGroupWigwag<Output>: Sendable where Output: FlagContainer {
name: String,
description: String?,
displayOption: FlagGroupDisplayOption?,
lookup: any FlagLookup
lookup: any FlagLookup,
) {
self.keyPath = keyPath
self.name = name
Expand Down Expand Up @@ -89,7 +89,7 @@ extension FlagGroupWigwag: AsyncSequence {
private func makeAsyncSequence() -> Sequence {
chain(
[ getOutput() ].async,
changes.map { _ in getOutput() }
changes.map { _ in getOutput() },
)
}

Expand All @@ -110,7 +110,7 @@ extension FlagGroupWigwag: Publisher {
public typealias Output = Output
public typealias Failure = Never

public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, S.Input == Output {
public func receive<S: Subscriber>(subscriber: S) where S.Failure == Failure, S.Input == Output {
FlagPublisher(makeAsyncSequence())
.receive(subscriber: subscriber)
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/Vexil/Observability/FlagWigwag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Combine
///
/// For more information on Wigwags see https://en.wikipedia.org/wiki/Wigwag_(flag_signals)
///
public struct FlagWigwag<Output>: Sendable where Output: FlagValue {
public struct FlagWigwag<Output: FlagValue>: Sendable {

// MARK: - Properties

Expand Down Expand Up @@ -67,7 +67,7 @@ public struct FlagWigwag<Output>: Sendable where Output: FlagValue {
defaultValue: Output,
description: String?,
displayOption: FlagDisplayOption,
lookup: any FlagLookup
lookup: any FlagLookup,
) {
self.keyPath = keyPath
self.name = name
Expand Down Expand Up @@ -99,7 +99,7 @@ extension FlagWigwag: AsyncSequence {
private func makeAsyncSequence() -> Sequence {
chain(
[ getOutput() ].async,
changes.map { _ in getOutput() }
changes.map { _ in getOutput() },
)
}

Expand All @@ -120,7 +120,7 @@ extension FlagWigwag: Publisher {
public typealias Output = Output
public typealias Failure = Never

public func receive<S>(subscriber: S) where S: Subscriber, S.Failure == Failure, S.Input == Output {
public func receive<S: Subscriber>(subscriber: S) where S.Failure == Failure, S.Input == Output {
FlagPublisher(makeAsyncSequence())
.receive(subscriber: subscriber)
}
Expand Down
Loading
Loading