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

Can't build with Swift6 #156

Open
soranoba opened this issue Sep 24, 2024 · 0 comments
Open

Can't build with Swift6 #156

soranoba opened this issue Sep 24, 2024 · 0 comments

Comments

@soranoba
Copy link
Contributor

If we installed the library with CocoaPods, the Swift version may be 6, because #127
And, currently this library cannot be built with Swift 6.
I hope that the swift_version will set or that it will be possible to build with Swift 6.

Swift6 build error

Config.swift

Static property 'dirPath' is not concurrency-safe because it is nonisolated global shared mutable state
Static property 'dirFrameworkPath' is not concurrency-safe because it is nonisolated global shared mutable state
Static property 'dirResourcePath' is not concurrency-safe because it is nonisolated global shared mutable state

The simplest solution is (However, Apple does not recommend it):

diff --git a/Sources/Fakery/Config.swift b/Sources/Fakery/Config.swift
index 819a8a5..d5799ac 100644
--- a/Sources/Fakery/Config.swift
+++ b/Sources/Fakery/Config.swift
@@ -1,7 +1,7 @@
 public struct Config {
   public static let defaultLocale: String = "en"
   public static let pathExtension: String = "json"
-  public static var dirPath: String = "Resources/Locales"
-  public static var dirFrameworkPath: String = ""
-  public static var dirResourcePath: String = ""
+  nonisolated(unsafe) public static var dirPath: String = "Resources/Locales"
+  nonisolated(unsafe) public static var dirFrameworkPath: String = ""
+  nonisolated(unsafe) public static var dirResourcePath: String = ""
 }

ref: https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/commonproblems/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant