diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0225c7a2..bacd3b46 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [ master ] + branches: [ "master" ] pull_request: - branches: [ master ] + branches: [ "*" ] env: CACHED_DEPENDENCY_PATHS: ${{ github.workspace }}/Tuist/Dependencies @@ -12,17 +12,20 @@ env: jobs: prepare-dependency: name: ⚙️ prepare for CI - runs-on: macos-latest + runs-on: macos-14 steps: - uses: actions/checkout@v2 + - uses: jdx/mise-action@v2 + with: + xcode-version: 15.2 - name: Install Tuist - run: curl -Ls https://install.tuist.io | bash + run: mise install tuist - name: Compute dependency cache key id: compute_hash - run: echo "hash=${{ hashFiles('Tuist/Dependencies.swift') }}" >> $GITHUB_OUTPUT + run: echo "hash=${{ hashFiles('Tuist/Package.swift') }}" >> $GITHUB_OUTPUT - name: Check dependency cache uses: actions/cache@v3 @@ -33,7 +36,7 @@ jobs: - name: Install dependencies if: steps.cache_dependencies.outputs.cache-hit == '' - run: tuist fetch + run: tuist install outputs: dependency_cache_key: ${{ steps.compute_hash.outputs.hash }} @@ -43,16 +46,17 @@ jobs: ENCRYPTED_GPLIST_FILE_PATH: ${{ 'iOS/Resources/GoogleService-Info.plist.gpg' }} DECRYPTED_GPLIST_FILE_PATH: ${{ 'iOS/Resources/GoogleService-Info.plist' }} GPLIST_PW: ${{ secrets.GOOGLE_SERVICE_ENCRYPTO_PW }} - runs-on: macos-latest + runs-on: macos-14 needs: prepare-dependency steps: - uses: actions/checkout@v2 with: - xcode-version: latest + xcode-version: 15.2 + - uses: jdx/mise-action@v2 - name: install tuist - run: curl -Ls https://install.tuist.io | bash + run: mise install tuist - name: configure GoogleService-Info.plist run: | @@ -67,7 +71,7 @@ jobs: - name: Install dependencies if: steps.cache_dependencies.outputs.cache-hit != 'true' - run: tuist fetch + run: tuist install - name: build tuist run: TUIST_CI=1 tuist build @@ -78,16 +82,17 @@ jobs: ENCRYPTED_GPLIST_FILE_PATH: ${{ 'iOS/Resources/GoogleService-Info.plist.gpg' }} DECRYPTED_GPLIST_FILE_PATH: ${{ 'iOS/Resources/GoogleService-Info.plist' }} GPLIST_PW: ${{ secrets.GOOGLE_SERVICE_ENCRYPTO_PW }} - runs-on: macos-latest + runs-on: macos-14 needs: prepare-dependency steps: - uses: actions/checkout@v2 + - uses: jdx/mise-action@v2 with: - xcode-version: latest + xcode-version: 15.2 - name: install tuist - run: curl -Ls https://install.tuist.io | bash + run: mise install tuist - name: configure GoogleService-Info.plist run: | @@ -102,8 +107,7 @@ jobs: - name: Install dependencies if: steps.cache_dependencies.outputs.cache-hit != 'true' - run: tuist fetch + run: tuist install - name: test tuist - run: TUIST_CI=1 tuist test - + run: TUIST_CI=1 tuist test --no-selective-testing diff --git a/.github/workflows/CachingTuistDependencies.yml b/.github/workflows/CachingTuistDependencies.yml index 3e9b50f3..67d78277 100644 --- a/.github/workflows/CachingTuistDependencies.yml +++ b/.github/workflows/CachingTuistDependencies.yml @@ -1,12 +1,10 @@ name: Caching with Tuist Dependencies on: - pull_request: - branches: - - master push: - branches: - - master + branches: [ "master" ] + pull_request: + branches: [ "*" ] env: CACHED_DEPENDENCY_PATHS: ${{ github.workspace }}/Tuist/Dependencies @@ -14,9 +12,12 @@ env: jobs: caching-dependencies: name: 🧩 Caching Dependencies - runs-on: macos-latest + runs-on: macos-14 steps: - uses: actions/checkout@v2 + - uses: jdx/mise-action@v2 + with: + xcode-version: 15.2 - name: Compute dependency cache key id: compute_hash @@ -31,11 +32,11 @@ jobs: - name: Install tuist if: steps.cache_dependencies.outputs.cache-hit != 'true' - run: curl -Ls https://install.tuist.io | bash + run: mise install tuist - name: Install dependencies if: steps.cache_dependencies.outputs.cache-hit != 'true' - run: tuist fetch + run: tuist install outputs: dependency_cache_key: ${{ steps.compute_hash.outputs.hash }} diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 00000000..97922179 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,2 @@ +[tools] +tuist = "4.8.1" diff --git a/.package.resolved b/.package.resolved index 3f90374f..55459174 100644 --- a/.package.resolved +++ b/.package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "600490cc27540b781885deee6ae54a1d2ad2d7effa7caed9cb01ecba8cb4ac6d", "pins" : [ { "identity" : "abseil-cpp-swiftpm", @@ -136,5 +137,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/.tuist-version b/.tuist-version deleted file mode 100644 index 3f67e25c..00000000 --- a/.tuist-version +++ /dev/null @@ -1 +0,0 @@ -3.17.0 diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 00000000..acbad2d7 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,284 @@ +{ + "pins" : [ + { + "identity" : "alamofire", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Alamofire/Alamofire.git", + "state" : { + "revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a", + "version" : "5.9.1" + } + }, + { + "identity" : "btimageview", + "kind" : "remoteSourceControl", + "location" : "https://github.com/baekteun/BTImageView.git", + "state" : { + "revision" : "dace5f951ec921fdf0d3cc48e05338d3cdd7fe80", + "version" : "1.1.2" + } + }, + { + "identity" : "configure", + "kind" : "remoteSourceControl", + "location" : "https://github.com/GSM-MSG/Configure.git", + "state" : { + "revision" : "60784ac8215d0c42b8b1d0964743dc5abadb39bd", + "version" : "1.0.1" + } + }, + { + "identity" : "cwlcatchexception", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattgallagher/CwlCatchException.git", + "state" : { + "revision" : "3ef6999c73b6938cc0da422f2c912d0158abb0a0", + "version" : "2.2.0" + } + }, + { + "identity" : "cwlpreconditiontesting", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattgallagher/CwlPreconditionTesting.git", + "state" : { + "revision" : "2ef56b2caf25f55fa7eef8784c30d5a767550f54", + "version" : "2.2.1" + } + }, + { + "identity" : "dpotpview", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Datt1994/DPOTPView.git", + "state" : { + "revision" : "950ecde0feef20f96abdd20a7442aa0ac2461626", + "version" : "1.5.12" + } + }, + { + "identity" : "gauthsignin-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/GSM-MSG/GAuthSignin-Swift.git", + "state" : { + "revision" : "ce6e6f82462fa861b3b10ae05307ec63b73c6cc9", + "version" : "0.0.3" + } + }, + { + "identity" : "inject", + "kind" : "remoteSourceControl", + "location" : "https://github.com/krzysztofzablocki/Inject.git", + "state" : { + "revision" : "04925668f57e74bc40f21b185a41c5585a84a9fe", + "version" : "1.2.2" + } + }, + { + "identity" : "kingfisher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/onevcat/Kingfisher.git", + "state" : { + "revision" : "e8625b80c413457b13ea9be75d07f6e9f5830c19", + "version" : "7.7.0" + } + }, + { + "identity" : "loaf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/schmidyy/Loaf", + "state" : { + "revision" : "31f3b3fff28918c49d69ee76be72b041161b67c7", + "version" : "0.6.0" + } + }, + { + "identity" : "lottie-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/airbnb/lottie-ios.git", + "state" : { + "revision" : "440a6eebb8a8ae9c773e9a3e21021b72a74ffbb7", + "version" : "4.1.2" + } + }, + { + "identity" : "moya", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Moya/Moya.git", + "state" : { + "revision" : "c263811c1f3dbf002be9bd83107f7cdc38992b26", + "version" : "15.0.3" + } + }, + { + "identity" : "msglayout", + "kind" : "remoteSourceControl", + "location" : "https://github.com/GSM-MSG/MSGLayout.git", + "state" : { + "revision" : "100d859e56c35bf6e16fb9b9afbf0718ae37d1bb", + "version" : "1.1.0" + } + }, + { + "identity" : "nimble", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Quick/Nimble.git", + "state" : { + "revision" : "b7f6c49acdb247e3158198c5448b38c3cc595533", + "version" : "11.2.1" + } + }, + { + "identity" : "pageboy", + "kind" : "remoteSourceControl", + "location" : "https://github.com/uias/Pageboy", + "state" : { + "revision" : "be0c1f6f1964cfb07f9d819b0863f2c3f255f612", + "version" : "4.2.0" + } + }, + { + "identity" : "panmodal", + "kind" : "remoteSourceControl", + "location" : "https://github.com/slackhq/PanModal.git", + "state" : { + "revision" : "b012aecb6b67a8e46369227f893c12544846613f", + "version" : "1.2.7" + } + }, + { + "identity" : "parkedtextfield", + "kind" : "remoteSourceControl", + "location" : "https://github.com/gmertk/ParkedTextField", + "state" : { + "revision" : "5e2838afd27d57edb399a9192fb10bb11f686ad3", + "version" : "1.0.0" + } + }, + { + "identity" : "quick", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Quick/Quick.git", + "state" : { + "revision" : "16910e406be96e08923918315388c3e989deac9e", + "version" : "6.1.0" + } + }, + { + "identity" : "reactiveswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ReactiveCocoa/ReactiveSwift.git", + "state" : { + "revision" : "c43bae3dac73fdd3cb906bd5a1914686ca71ed3c", + "version" : "6.7.0" + } + }, + { + "identity" : "reactorkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ReactorKit/ReactorKit.git", + "state" : { + "revision" : "8fa33f09c6f6621a2aa536d739956d53b84dd139", + "version" : "3.2.0" + } + }, + { + "identity" : "reusable", + "kind" : "remoteSourceControl", + "location" : "https://github.com/AliSoftware/Reusable.git", + "state" : { + "revision" : "18674709421360e210c2ecd4e8e08b217d4ea61d", + "version" : "4.1.2" + } + }, + { + "identity" : "rxdatasources", + "kind" : "remoteSourceControl", + "location" : "https://github.com/RxSwiftCommunity/RxDataSources.git", + "state" : { + "revision" : "90c29b48b628479097fe775ed1966d75ac374518", + "version" : "5.0.2" + } + }, + { + "identity" : "rxflow", + "kind" : "remoteSourceControl", + "location" : "https://github.com/RxSwiftCommunity/RxFlow.git", + "state" : { + "revision" : "d8d4e53d05239f1ec1bd8bec173907868afa0fa1", + "version" : "2.13.0" + } + }, + { + "identity" : "rxgesture", + "kind" : "remoteSourceControl", + "location" : "https://github.com/RxSwiftCommunity/RxGesture.git", + "state" : { + "revision" : "1b137c576b4aaaab949235752278956697c9e4a0", + "version" : "4.0.4" + } + }, + { + "identity" : "rxkeyboard", + "kind" : "remoteSourceControl", + "location" : "https://github.com/RxSwiftCommunity/RxKeyboard.git", + "state" : { + "revision" : "085fd99d7bb4f98e671904fcfe7ff561e66574ad", + "version" : "2.0.0" + } + }, + { + "identity" : "rxswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ReactiveX/RxSwift", + "state" : { + "revision" : "b4307ba0b6425c0ba4178e138799946c3da594f8", + "version" : "6.5.0" + } + }, + { + "identity" : "snapkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SnapKit/SnapKit.git", + "state" : { + "revision" : "f222cbdf325885926566172f6f5f06af95473158", + "version" : "5.6.0" + } + }, + { + "identity" : "swinject", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Swinject/Swinject.git", + "state" : { + "revision" : "8bc503e60965298984fb58cf47b71c541449fe2a", + "version" : "2.8.3" + } + }, + { + "identity" : "tabman", + "kind" : "remoteSourceControl", + "location" : "https://github.com/uias/Tabman.git", + "state" : { + "revision" : "3b2213290eb93e55bb50b49d1a179033005c11ab", + "version" : "3.2.0" + } + }, + { + "identity" : "viewanimator", + "kind" : "remoteSourceControl", + "location" : "https://github.com/marcosgriselli/ViewAnimator.git", + "state" : { + "revision" : "55f1c46241b181c3e0b68d70edb6d87926c7d183", + "version" : "3.1.0" + } + }, + { + "identity" : "weakmaptable", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ReactorKit/WeakMapTable.git", + "state" : { + "revision" : "cb05d64cef2bbf51e85c53adee937df46540a74e", + "version" : "1.2.1" + } + } + ], + "version" : 2 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..3042ec77 --- /dev/null +++ b/Package.swift @@ -0,0 +1,34 @@ +// swift-tools-version: 5.7 + +import PackageDescription + +let package = Package( + name: "PackageName", + dependencies: [ + .package(url: "https://github.com/ReactiveX/RxSwift", exact: "6.5.0"), + .package(url: "https://github.com/Moya/Moya.git", exact: "15.0.3"), + .package(url: "https://github.com/SnapKit/SnapKit.git", exact: "5.6.0"), + .package(url: "https://github.com/Swinject/Swinject.git", exact: "2.8.3"), + .package(url: "https://github.com/RxSwiftCommunity/RxFlow.git", exact: "2.13.0"), + .package(url: "https://github.com/ReactorKit/ReactorKit.git", exact: "3.2.0"), + .package(url: "https://github.com/onevcat/Kingfisher.git", exact: "7.7.0"), + .package(url: "https://github.com/RxSwiftCommunity/RxDataSources.git", exact: "5.0.2"), + .package(url: "https://github.com/AliSoftware/Reusable.git", exact: "4.1.2"), + .package(url: "https://github.com/baekteun/BTImageView.git", exact: "1.1.2"), + .package(url: "https://github.com/RxSwiftCommunity/RxGesture.git", exact: "4.0.4"), + .package(url: "https://github.com/slackhq/PanModal.git", exact: "1.2.7"), + .package(url: "https://github.com/airbnb/lottie-ios.git", exact: "4.1.2"), + .package(url: "https://github.com/marcosgriselli/ViewAnimator.git", exact: "3.1.0"), + .package(url: "https://github.com/Quick/Quick.git", exact: "6.1.0"), + .package(url: "https://github.com/Quick/Nimble.git", exact: "11.2.1"), + .package(url: "https://github.com/Datt1994/DPOTPView.git", exact: "1.5.12"), + .package(url: "https://github.com/uias/Tabman.git", exact: "3.2.0"), + .package(url: "https://github.com/RxSwiftCommunity/RxKeyboard.git", exact: "2.0.0"), + .package(url: "https://github.com/schmidyy/Loaf", exact: "0.6.0"), + .package(url: "https://github.com/gmertk/ParkedTextField", exact: "1.0.0"), + .package(url: "https://github.com/krzysztofzablocki/Inject.git", exact: "1.2.2"), + .package(url: "https://github.com/GSM-MSG/MSGLayout.git", exact: "1.1.0"), + .package(url: "https://github.com/GSM-MSG/GAuthSignin-Swift.git", exact: "0.0.3"), + .package(url: "https://github.com/GSM-MSG/Configure.git", from: "1.0.0"), + ] +) diff --git a/Service/Project.swift b/Service/Project.swift index 409b61a7..382f48ca 100644 --- a/Service/Project.swift +++ b/Service/Project.swift @@ -3,11 +3,11 @@ import ProjectDescriptionHelpers let project = Project.dynamicFramework( name: "Service", - platform: .iOS, + destinations: .iOS, infoPlist: .extendingDefault( with: [ "BASE_URL": "$(BASE_URL)" ] ), - deploymentTarget: .iOS(targetVersion: "14.0", devices: [.iphone, .ipad]) + deploymentTarget: .iOS("14.0") ) diff --git a/ThirdPartyLib/Project.swift b/ThirdPartyLib/Project.swift index 6006cd43..7d12d54e 100644 --- a/ThirdPartyLib/Project.swift +++ b/ThirdPartyLib/Project.swift @@ -8,7 +8,7 @@ let project = Project.dynamicFramework( .Firebase, .IQKeyboardManager ], - deploymentTarget: .iOS(targetVersion: "14.0", devices: [.iphone, .ipad]), + deploymentTarget: .iOS("14.0"), dependencies: [ .SPM.FCM, .SPM.Swinject, diff --git a/Tuist/Dependencies.swift b/Tuist/Dependencies.swift index 9cec969f..f1173227 100644 --- a/Tuist/Dependencies.swift +++ b/Tuist/Dependencies.swift @@ -7,7 +7,7 @@ let dependencies = Dependencies( .remote(url: "https://github.com/ReactiveX/RxSwift", requirement: .exact("6.5.0")), .remote(url: "https://github.com/GSM-MSG/Moya.git", requirement: .branch("master")), .remote(url: "https://github.com/SnapKit/SnapKit.git", requirement: .exact("5.6.0")), - .remote(url: "https://github.com/Swinject/Swinject.git", requirement: .exact("2.8.3")), + .remote(url: "https://github.com/Swinject/Swinject.git", requirement: .exact("2.8.8")), .remote(url: "https://github.com/RxSwiftCommunity/RxFlow.git", requirement: .exact("2.13.0")), .remote(url: "https://github.com/ReactorKit/ReactorKit.git", requirement: .exact("3.2.0")), .remote(url: "https://github.com/onevcat/Kingfisher.git", requirement: .exact("7.7.0")), diff --git a/Tuist/ProjectDescriptionHelpers/DynamicFramework.swift b/Tuist/ProjectDescriptionHelpers/DynamicFramework.swift index e8bd7d6c..f6b50b73 100644 --- a/Tuist/ProjectDescriptionHelpers/DynamicFramework.swift +++ b/Tuist/ProjectDescriptionHelpers/DynamicFramework.swift @@ -6,10 +6,10 @@ let isCI = (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? tru extension Project{ public static func dynamicFramework( name: String, - platform: Platform = .iOS, + destinations: Destinations = .iOS, packages: [Package] = [], infoPlist: InfoPlist = .default, - deploymentTarget: DeploymentTarget, + deploymentTarget: DeploymentTargets, resources: ResourceFileElements? = nil, dependencies: [TargetDependency] = [ .project(target: "ThirdPartyLib", path: Path("../ThirdPartyLib")) @@ -28,12 +28,12 @@ extension Project{ .release(name: .release, xcconfig: .relativeToXCConfig(type: .release, name: name)) ]), targets: [ - Target( + .target( name: name, - platform: platform, + destinations: destinations, product: .framework, bundleId: "\(publicOrganizationName).\(name)", - deploymentTarget: deploymentTarget, + deploymentTargets: deploymentTarget, infoPlist: infoPlist, sources: ["Sources/**"], resources: resources, diff --git a/Tuist/ProjectDescriptionHelpers/Excutable.swift b/Tuist/ProjectDescriptionHelpers/Excutable.swift index a0ff92c5..4f59b041 100644 --- a/Tuist/ProjectDescriptionHelpers/Excutable.swift +++ b/Tuist/ProjectDescriptionHelpers/Excutable.swift @@ -1,11 +1,11 @@ import ProjectDescription extension Project{ - public static func excutable( + public static func makeModule( name: String, - platform: Platform, + destinations: Destinations = .iOS, product: Product = .app, - deploymentTarget: DeploymentTarget = .iOS(targetVersion: "13.0", devices: [.iphone, .ipad]), + deploymentTarget: DeploymentTargets = .iOS("15.0"), dependencies: [TargetDependency], resources: ResourceFileElements? = nil, settings: Settings? = nil @@ -26,27 +26,27 @@ extension Project{ .release(name: .release, xcconfig: .relativeToXCConfig(type: .release, name: name)) ]), targets: [ - Target( + .target( name: name, - platform: platform, + destinations: destinations, product: product, bundleId: "\(publicOrganizationName).\(name)", - deploymentTarget: deploymentTarget, + deploymentTargets: deploymentTarget, infoPlist: .file(path: Path("Support/Info.plist")), sources: ["Sources/**"], resources: resources, - entitlements: Path("Support/\(name).entitlements"), + entitlements: .file(path: Path("Support/\(name).entitlements")), dependencies: [ .project(target: "ThirdPartyLib", path: Path("../ThirdPartyLib")), ] + dependencies, settings: settings ), - Target( + .target( name: "\(name)Test", - platform: platform, + destinations: destinations, product: .unitTests, bundleId: "\(publicOrganizationName).\(name)Test", - deploymentTarget: deploymentTarget, + deploymentTargets: deploymentTarget, infoPlist: .default, sources: ["Tests/**"], dependencies: [ diff --git a/iOS/Derived/Sources/TuistAssets+GCMS.swift b/iOS/Derived/Sources/TuistAssets+GCMS.swift index c2919f6e..967a6a32 100644 --- a/iOS/Derived/Sources/TuistAssets+GCMS.swift +++ b/iOS/Derived/Sources/TuistAssets+GCMS.swift @@ -21,7 +21,7 @@ // swiftlint:disable identifier_name line_length nesting type_body_length type_name public enum GCMSAsset { public enum Colors { - public static let gcmsBackgroundColor = GCMSColors(name: "GCMS_BackgroundColor") + public static let gcmsBackgroundColor = GCMSColors(name: "GCMS_BackgroundColor") public static let gcmsMainColor = GCMSColors(name: "GCMS_MainColor") public static let gcmsOnBoardingMainColor = GCMSColors(name: "GCMS_OnBoardingMainColor") public static let gcmsThemeColor = GCMSColors(name: "GCMS_ThemeColor") @@ -33,7 +33,7 @@ public enum GCMSAsset { public static let gcmsGray6 = GCMSColors(name: "GCMS_Gray6") } public enum Images { - public static let gcmsEditorial = GCMSImages(name: "GCMS_Editorial") + public static let gcmsEditorial = GCMSImages(name: "GCMS_Editorial") public static let gcmsEditorialGray = GCMSImages(name: "GCMS_Editorial_Gray") public static let gcmsFreedom = GCMSImages(name: "GCMS_Freedom") public static let gcmsFreedomGray = GCMSImages(name: "GCMS_Freedom_gray") @@ -58,11 +58,11 @@ public final class GCMSColors { #if os(macOS) public typealias Color = NSColor - #elseif os(iOS) || os(tvOS) || os(watchOS) + #elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) public typealias Color = UIColor #endif - @available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *) + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, visionOS 1.0, *) public private(set) lazy var color: Color = { guard let color = Color(asset: self) else { fatalError("Unable to load color asset named \(name).") @@ -72,7 +72,7 @@ public final class GCMSColors { #if canImport(SwiftUI) private var _swiftUIColor: Any? = nil - @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *) public private(set) var swiftUIColor: SwiftUI.Color { get { if self._swiftUIColor == nil { @@ -93,10 +93,10 @@ public final class GCMSColors { } public extension GCMSColors.Color { - @available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *) + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, visionOS 1.0, *) convenience init?(asset: GCMSColors) { let bundle = GCMSResources.bundle - #if os(iOS) || os(tvOS) + #if os(iOS) || os(tvOS) || os(visionOS) self.init(named: asset.name, in: bundle, compatibleWith: nil) #elseif os(macOS) self.init(named: NSColor.Name(asset.name), bundle: bundle) @@ -107,7 +107,7 @@ public extension GCMSColors.Color { } #if canImport(SwiftUI) -@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *) +@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *) public extension SwiftUI.Color { init(asset: GCMSColors) { let bundle = GCMSResources.bundle @@ -121,13 +121,13 @@ public struct GCMSImages { #if os(macOS) public typealias Image = NSImage - #elseif os(iOS) || os(tvOS) || os(watchOS) + #elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) public typealias Image = UIImage #endif public var image: Image { let bundle = GCMSResources.bundle - #if os(iOS) || os(tvOS) + #if os(iOS) || os(tvOS) || os(visionOS) let image = Image(named: name, in: bundle, compatibleWith: nil) #elseif os(macOS) let image = bundle.image(forResource: NSImage.Name(name)) @@ -141,30 +141,15 @@ public struct GCMSImages { } #if canImport(SwiftUI) - @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *) public var swiftUIImage: SwiftUI.Image { SwiftUI.Image(asset: self) } #endif } -public extension GCMSImages.Image { - @available(macOS, deprecated, - message: "This initializer is unsafe on macOS, please use the GCMSImages.image property") - convenience init?(asset: GCMSImages) { - #if os(iOS) || os(tvOS) - let bundle = GCMSResources.bundle - self.init(named: asset.name, in: bundle, compatibleWith: nil) - #elseif os(macOS) - self.init(named: NSImage.Name(asset.name)) - #elseif os(watchOS) - self.init(named: asset.name) - #endif - } -} - #if canImport(SwiftUI) -@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *) +@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *) public extension SwiftUI.Image { init(asset: GCMSImages) { let bundle = GCMSResources.bundle diff --git a/iOS/Derived/Sources/TuistBundle+GCMS.swift b/iOS/Derived/Sources/TuistBundle+GCMS.swift index b4602f42..bd86b47f 100644 --- a/iOS/Derived/Sources/TuistBundle+GCMS.swift +++ b/iOS/Derived/Sources/TuistBundle+GCMS.swift @@ -8,17 +8,17 @@ import Foundation private class BundleFinder {} extension Foundation.Bundle { - /// Since GCMS is a application, the bundle for classes within this module can be used directly. - static let module = Bundle(for: BundleFinder.self) +/// Since GCMS is a application, the bundle for classes within this module can be used directly. +static let module = Bundle(for: BundleFinder.self) } // MARK: - Objective-C Bundle Accessor @objc public class GCMSResources: NSObject { - @objc public class var bundle: Bundle { - return .module - } +@objc public class var bundle: Bundle { + return .module +} } // swiftlint:enable all // swiftformat:enable all diff --git a/iOS/Derived/Sources/TuistFonts+GCMS.swift b/iOS/Derived/Sources/TuistFonts+GCMS.swift index 4aa2cb48..71acef1f 100644 --- a/iOS/Derived/Sources/TuistFonts+GCMS.swift +++ b/iOS/Derived/Sources/TuistFonts+GCMS.swift @@ -5,9 +5,12 @@ #if os(macOS) import AppKit.NSFont -#elseif os(iOS) || os(tvOS) || os(watchOS) +#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) import UIKit.UIFont #endif +#if canImport(SwiftUI) + import SwiftUI +#endif // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length @@ -48,7 +51,7 @@ public struct GCMSFontConvertible { #if os(macOS) public typealias Font = NSFont - #elseif os(iOS) || os(tvOS) || os(watchOS) + #elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) public typealias Font = UIFont #endif @@ -59,6 +62,20 @@ public struct GCMSFontConvertible { return font } + #if canImport(SwiftUI) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *) + public func swiftUIFont(size: CGFloat) -> SwiftUI.Font { + guard let font = Font(font: self, size: size) else { + fatalError("Unable to initialize font '\(name)' (\(family))") + } + #if os(macOS) + return SwiftUI.Font.custom(font.fontName, size: font.pointSize) + #elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) + return SwiftUI.Font(font) + #endif + } + #endif + public func register() { // swiftlint:disable:next conditional_returns_on_newline guard let url = url else { return } @@ -73,7 +90,7 @@ public struct GCMSFontConvertible { public extension GCMSFontConvertible.Font { convenience init?(font: GCMSFontConvertible, size: CGFloat) { - #if os(iOS) || os(tvOS) || os(watchOS) + #if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) { font.register() } diff --git a/iOS/Project.swift b/iOS/Project.swift index 9c1ea98b..8ff0e2fe 100644 --- a/iOS/Project.swift +++ b/iOS/Project.swift @@ -1,10 +1,10 @@ import ProjectDescriptionHelpers import ProjectDescription -let project = Project.excutable( +let project = Project.makeModule( name: "GCMS", - platform: .iOS, - deploymentTarget: .iOS(targetVersion: "14.0", devices: [.iphone, .ipad]), + destinations: .iOS, + deploymentTarget: .iOS("14.0"), dependencies: [ .project(target: "Service", path: "../Service") ],