Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 6 #102

Merged
merged 37 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1e2621f
Make changes so the projects builds and passes
0xLeif Sep 19, 2024
8d6cd44
Update macOS.yml
0xLeif Sep 19, 2024
4e90bc4
Update macOS.yml
0xLeif Sep 19, 2024
84fe03e
Update ubuntu.yml
0xLeif Sep 19, 2024
c8b7c3b
Update windows.yml
0xLeif Sep 19, 2024
5c64860
Update windows.yml
0xLeif Sep 19, 2024
d420020
Update ubuntu.yml
0xLeif Sep 19, 2024
48ee7da
Fix windows and linux error
0xLeif Sep 19, 2024
68bb8ed
Add MainActor where needed
0xLeif Sep 19, 2024
a264454
Update AppLogger to struct from class
0xLeif Sep 19, 2024
28aaaaa
Import foundation
0xLeif Sep 19, 2024
c2f1112
Add mirror function
0xLeif Sep 19, 2024
6398a78
Fix mirror functions
0xLeif Sep 19, 2024
cd12a86
Fix windows and ubuntu tests
0xLeif Sep 19, 2024
36ce3f8
Fix windows error ci
0xLeif Sep 19, 2024
75755c7
Update ubuntu.yml
0xLeif Sep 19, 2024
3b73abe
Revert change.
0xLeif Sep 19, 2024
691b5de
Add Loggable protocol for state and dependency
0xLeif Sep 19, 2024
13298e4
Update README
0xLeif Sep 19, 2024
d9cf656
Update ubuntu.yml
0xLeif Sep 19, 2024
13dd27d
Fix "class 'ApplicationTests' does not conform to the 'Sendable' prot…
0xLeif Sep 19, 2024
945c2a9
Attempt to fix Linux and Windows CI
0xLeif Sep 19, 2024
51f80e9
TEMP: Remove all but one test.
0xLeif Sep 19, 2024
e4d5549
Add back another test
0xLeif Sep 19, 2024
496df33
Add back another test
0xLeif Sep 19, 2024
118421a
Remove test from testcase
0xLeif Sep 19, 2024
40160d3
Remove remaining tests leaving setup and teardown
0xLeif Sep 19, 2024
1101e79
Add test that is expected to fail
0xLeif Sep 19, 2024
9fe495b
Attempt a simple fix.
0xLeif Sep 19, 2024
528e99f
Leave a few lines for the failing test
0xLeif Sep 20, 2024
e3aa6c4
Leave a single line to determine the issue
0xLeif Sep 20, 2024
c388b2a
Move around MainActor
0xLeif Sep 20, 2024
2718954
Attempt to fix CI
0xLeif Sep 20, 2024
b3c5973
Attempt to fix failing test
0xLeif Sep 20, 2024
b26ee51
Update tests to hopefully pass
0xLeif Sep 20, 2024
3856eda
Attemp to fix dependency slice tests
0xLeif Sep 20, 2024
5e2af62
Attempt to fix all tests for linux and windows
0xLeif Sep 20, 2024
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
27 changes: 12 additions & 15 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: macOS

on:
push:
branches: ["**"]
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: macos-13

runs-on: macos-latest
steps:
- uses: swift-actions/setup-swift@v1
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v3
- name: Build for release
run: swift build -v -c release
- name: Test
run: swift test -v
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 16.0
- uses: actions/checkout@v3
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v
6 changes: 4 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: swift-actions/setup-swift@v1
- uses: sersoft-gmbh/swifty-linux-action@v3
with:
release-version: 6.0
- uses: actions/checkout@v3
- name: Build for release
run: swift build -v -c release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
steps:
- uses: compnerd/gha-setup-swift@main
with:
branch: swift-5.9.2-release
tag: 5.9.2-RELEASE
branch: swift-6.0-release
tag: 6.0-RELEASE

- uses: actions/checkout@v2
- run: swift build
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.9
// swift-tools-version: 6.0

import PackageDescription

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

AppState is a Swift Package that simplifies the management of application state in a thread-safe, type-safe, and SwiftUI-friendly way. Featuring dedicated struct types for managing state, AppState provides easy and coordinated access to this state across your application. Added to this, the package incorporates built-in logging mechanisms to aid debugging and error tracking. The AppState package also boasts a cache-based system to persistently store and retrieve any application-wide data at any given time.

**Requirements:** iOS 15.0+ / watchOS 8.0+ / macOS 11.0+ / tvOS 15.0+ / visionOS 1.0+ | Swift 5.9+ / Xcode 15+
**Requirements:** iOS 15.0+ / watchOS 8.0+ / macOS 11.0+ / tvOS 15.0+ / visionOS 1.0+ | Swift 6.0+ / Xcode 16+

**Non Apple Platform Support:** Linux & Windows

Expand Down Expand Up @@ -54,7 +54,7 @@ To integrate AppState into your Swift project, you'll need to use the Swift Pack

```swift
dependencies: [
.package(url: "https://github.com/0xLeif/AppState.git", from: "1.0.0")
.package(url: "https://github.com/0xLeif/AppState.git", from: "2.0.0")
]
```

Expand Down Expand Up @@ -357,18 +357,18 @@ extension Application {
}

// Mock network service
class MockNetworkService: NetworkServiceType {
class MockNetworkService: NetworkServiceType, Sendable {
// Your mock implementation
}

func testNetworkService() {
func testNetworkService() async {
// Keep hold of the `DependencyOverride` for the duration of your test.
let networkOverride = Application.override(\.networkService, with: MockNetworkService())

let mockNetworkService = Application.dependency(\.networkService)

// Once done, you can allow the `DependencyOverrideen` to be deallocated
// or call `networkOverride.cancel()` to revert back to the original service.
// call `networkOverride.cancel()` to revert back to the original service.
await networkOverride.cancel()
}
```

Expand Down
10 changes: 9 additions & 1 deletion Sources/AppState/Application/Application+internal.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
extension Application {
@MainActor
static var cacheDescription: String {
shared.cache.allValues
.map { key, value in
"\t- \(value)"
if let value = value as? Loggable {
"\t- \(value.logValue)"
} else {
"\t- \(value)"
}
}
.sorted(by: <)
.joined(separator: "\n")
Expand All @@ -28,6 +33,7 @@ extension Application {
}

/// Internal log function.
@MainActor
static func log(
debug message: String,
fileID: StaticString,
Expand All @@ -45,6 +51,7 @@ extension Application {
}

/// Internal log function.
@MainActor
static func log(
debug message: () -> String,
fileID: StaticString,
Expand Down Expand Up @@ -72,6 +79,7 @@ extension Application {
}

/// Internal log function.
@MainActor
static func log(
error: Error,
message: String,
Expand Down
Loading
Loading