Skip to content

Commit

Permalink
Merge pull request #45 from antoniostrijdom/swift-6-support
Browse files Browse the repository at this point in the history
Swift 6 support
  • Loading branch information
albertodebortoli committed May 1, 2024
2 parents faaa203 + c923740 commit ba9d0a9
Show file tree
Hide file tree
Showing 24 changed files with 59 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-TogglesDemo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:
- main

env:
XCODE_VERSION: 14.0.1
XCODE_VERSION: 15.2.0

jobs:
test:
name: Build
runs-on: macos-12
runs-on: macos-14
steps:
- name: Show macOS version
run: sw_vers
Expand All @@ -36,4 +36,4 @@ jobs:
run: xcodebuild -showdestinations -scheme TogglesDemo
- name: Build for destination TogglesDemo
working-directory: ./TogglesDemo
run: xcodebuild build -scheme TogglesDemo -destination "platform=iOS Simulator,OS=16.0,name=iPhone 14 Pro"
run: xcodebuild build -scheme TogglesDemo -destination "platform=iOS Simulator,OS=17.2,name=iPhone 15 Pro"
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
- '*'

env:
XCODE_VERSION: 14.0.1
XCODE_VERSION: 15.2.0

jobs:
publish-release:
name: Publish release ${{ github.ref_name }}
runs-on: macos-12
runs-on: macos-14
steps:
- name: Show macOS version (${{ env.XCODE_VERSION }})
run: sw_vers
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-JustTweakMigrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:
- main

env:
XCODE_VERSION: 14.0.1
XCODE_VERSION: 15.2.0

jobs:
test:
name: Run tests
runs-on: macos-12
runs-on: macos-14
steps:
- name: Code Checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-ToggleCipher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:
- main

env:
XCODE_VERSION: 14.0.1
XCODE_VERSION: 15.2.0

jobs:
test:
name: Run tests
runs-on: macos-12
runs-on: macos-14
steps:
- name: Code Checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-ToggleGen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:
- main

env:
XCODE_VERSION: 14.0.1
XCODE_VERSION: 15.2.0

jobs:
test:
name: Run tests
runs-on: macos-12
runs-on: macos-14
steps:
- name: Code Checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-Toggles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:
- main

env:
XCODE_VERSION: 14.0.1
XCODE_VERSION: 15.2.0

jobs:
test:
name: Run tests
runs-on: macos-12
runs-on: macos-14
steps:
- name: Code Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion JustTweakMigrator/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.6
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
2 changes: 1 addition & 1 deletion Sources/Models/Object.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation

/// Model representing object value for a Toggle.
/// It container to access a object as a dictionary or a concrete type `T`
public struct Object {
public struct Object: Sendable {
public let map: [Variable: ObjectSupportedType]

public init(map: [Variable: ObjectSupportedType]) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Models/ObjectSupportedType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation

/// Supported types for `Object`
public enum ObjectSupportedType {
public enum ObjectSupportedType: Sendable {
case bool(Bool)
case int(Int)
case number(Double)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Models/Value.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation

/// Value associated with a toggle.
public enum Value: Equatable, Codable {
public enum Value: Equatable, Codable, Sendable {
case bool(Bool)
case int(Int)
case number(Double)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Protocols/MutableValueProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation

/// Protocol to be implemented by custom mutable value providers.
/// A MutableValueProvider is a ValueProvider that allows settings and deleting values for given variables.
public protocol MutableValueProvider: ValueProvider {
public protocol MutableValueProvider: ValueProvider & Sendable {

/// Sets the value for a variable.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/Protocols/ValueProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation

/// Protocol to be implemented by custom value providers.
/// A ValueProvider allows retrieving values for given variables.
public protocol ValueProvider {
public protocol ValueProvider: Sendable {
var name: String { get }

/// Retrieve the value for a variable.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Providers/InMemoryValueProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation

/// Mutable value provider that stores toggles in memory.
/// Alterations to toggles are not persisted.
final public class InMemoryValueProvider {
final public class InMemoryValueProvider: @unchecked Sendable {

public let name: String

Expand Down
2 changes: 1 addition & 1 deletion Sources/Providers/PersistentValueProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ private let userDefaultsKeyPrefix = "com.toggles"

/// Mutable value provider that persists toggles in the user defaults.
/// Alterations to toggles are therefore persisted across app restarts and updates.
final public class PersistentValueProvider {
final public class PersistentValueProvider: @unchecked Sendable {

public let name: String

Expand Down
2 changes: 1 addition & 1 deletion Sources/ToggleManager/ToggleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Combine
import Foundation

/// Thread-safe facade to interface with toggles.
final public class ToggleManager: ObservableObject {
final public class ToggleManager: ObservableObject, @unchecked Sendable {

public struct ToggleManagerOptions: OptionSet {
public var rawValue: UInt
Expand Down
4 changes: 2 additions & 2 deletions Tests/Utilities/MockRemoteValueProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import Foundation
@testable import Toggles

final class MockRemoteValueProvider: ValueProvider {
final class MockRemoteValueProvider: ValueProvider, @unchecked Sendable {

var name: String = "Remote (mock)"
let name: String = "Remote (mock)"

private var toggles: [Variable: Value]

Expand Down
4 changes: 2 additions & 2 deletions Tests/Utilities/SingleValueMockProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import Foundation
import Toggles

class MockSingleValueProvider: ValueProvider {
final class MockSingleValueProvider: ValueProvider {

var name: String = "SingleValue (mock)"
let name: String = "SingleValue (mock)"

private let value: Value

Expand Down
30 changes: 27 additions & 3 deletions ToggleCipher/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.6
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -20,10 +20,34 @@ let package = Package(
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser")
],
path: "Sources"),
path: "Sources",
swiftSettings: [
.enableExperimentalFeature("ConciseMagicFile"),
.enableExperimentalFeature("ForwardTrailingClosures"),
.enableExperimentalFeature("BareSlashRegexLiterals"),
.enableExperimentalFeature("DeprecateApplicationMain"),
.enableExperimentalFeature("ImportObjcForwardDeclarations"),
.enableExperimentalFeature("DisableOutwardActorInference"),
.enableExperimentalFeature("InternalImportsByDefault"),
.enableExperimentalFeature("ExistentialAny"),
.enableExperimentalFeature("ImplicitOpenExistentials"),
.enableExperimentalFeature("StrictConcurrency")
]),
.testTarget(
name: "ToggleCipherTests",
dependencies: ["ToggleCipher"],
path: "Tests")
path: "Tests",
swiftSettings: [
.enableExperimentalFeature("ConciseMagicFile"),
.enableExperimentalFeature("ForwardTrailingClosures"),
.enableExperimentalFeature("BareSlashRegexLiterals"),
.enableExperimentalFeature("DeprecateApplicationMain"),
.enableExperimentalFeature("ImportObjcForwardDeclarations"),
.enableExperimentalFeature("DisableOutwardActorInference"),
.enableExperimentalFeature("InternalImportsByDefault"),
.enableExperimentalFeature("ExistentialAny"),
.enableExperimentalFeature("ImplicitOpenExistentials"),
.enableExperimentalFeature("StrictConcurrency")
])
]
)
2 changes: 1 addition & 1 deletion ToggleGen/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.6
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
2 changes: 1 addition & 1 deletion TogglesDemo/TogglesDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
"OTHER_SWIFT_FLAGS[arch=*]" = "-Xfrontend -enable-actor-data-race-checks";
"OTHER_SWIFT_FLAGS[arch=*]" = "-Xfrontend -enable-actor-data-race-checks -warn-concurrency";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down
2 changes: 1 addition & 1 deletion TogglesDemo/TogglesDemo/Sources/DemoConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DemoConfiguration {

let datasourceUrl: URL
let remoteValueProvider: RemoteValueProvider
let localValueProvider: ValueProvider
let localValueProvider: LocalValueProvider
let cipherConfiguration: CipherConfiguration
let manager: ToggleManager

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation
import Toggles

public class RemoteValueProvider: ValueProvider {
public class RemoteValueProvider: ValueProvider, @unchecked Sendable {

public var name: String = "Remote (demo)"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import SwiftUI
import Toggles

@MainActor
struct ToggleObservablesView: View {

let message = """
Expand Down

0 comments on commit ba9d0a9

Please sign in to comment.