diff --git a/.github/actions/install-certficates/action.yml b/.github/actions/install-certficates/action.yml new file mode 100644 index 000000000..4b1e2efc9 --- /dev/null +++ b/.github/actions/install-certficates/action.yml @@ -0,0 +1,32 @@ +name: 'Install iOS Certificates' + +description: 'Install the Apple certificate and provisioning profile' + +runs: + using: "composite" + steps: + - name: Install certificates + shell: bash + env: + BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + run: | + # create variables + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 + PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + + # import certificate and provisioning profile from secrets + echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH + + # create temporary keychain + security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + + # import certificate to keychain + security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security list-keychain -d user -s $KEYCHAIN_PATH diff --git a/.github/workflows/release_icons.yml b/.github/workflows/release_icons.yml new file mode 100644 index 000000000..420f0d41e --- /dev/null +++ b/.github/workflows/release_icons.yml @@ -0,0 +1,71 @@ +name: 'Publish icons Release' + +on: + pull_request: + push: + tags: + - "SDDSIcons-v[0-9]+.[0-9]+.[0-9]+" + +concurrency: + # New commit on branch cancels running workflows of the same branch + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + generate-distribution: + name: Generate icons distribution zip + runs-on: macos-latest + environment: sdds + steps: + - name: Checkout the code + uses: actions/checkout@v4 + + - name: Set up Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 'latest' + + - name: Install the Apple certificate and provisioning profile + env: + BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + run: | + # create variables + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 + PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + + # import certificate and provisioning profile from secrets + echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH + + # create temporary keychain + security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + + # import certificate to keychain + security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security list-keychain -d user -s $KEYCHAIN_PATH + + - name: Build SDDSIcons + run: | + xcodebuild -project SDDSIcons/SDDSIcons.xcodeproj -scheme "Build XCFramework" BUILD_DIR=./build + + - name: Generate distribution zip + id: zip_artifact + run: | + #TAG_NAME=${GITHUB_REF#refs/tags/} + TAG_NAME="SDDSIcons-v0.0.1" + echo "Tag name: $TAG_NAME" + zip -r "${TAG_NAME}.zip" ./SDDSIcons/build/SDDSIcons.xcframework + echo "::set-output name=zip_path::${TAG_NAME}.zip" + + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: ${{ steps.zip_artifact.outputs.zip_path }} + tag_name: "0.0.1" #github.ref + token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/update_icons.yml b/.github/workflows/update_icons.yml new file mode 100644 index 000000000..02ac0c7a9 --- /dev/null +++ b/.github/workflows/update_icons.yml @@ -0,0 +1,109 @@ +name: Update Icons Pack + +on: + workflow_dispatch: + inputs: + plasma-ref: + required: true + default: master + plasma-version: + required: true + repository_dispatch: + types: [ build-icons ] + +jobs: + icons: + runs-on: macos-latest + environment: sdds + env: + lerna-scope: '--scope="@salutejs/plasma-icons"' + + steps: + # делаем сheckout в текущем репозитория + - name: Checkout + uses: actions/checkout@v4 + with: + show-progress: false + fetch-depth: 0 + path: current + + # делаем сheckout репозитория plasma + - name: Checkout to Plasma Web + uses: actions/checkout@v4 + with: + repository: salute-developers/plasma + #ref: ${{ github.event.client_payload.ref || github.event.inputs.plasma-ref }} + ref: feat-icons-png-generator + show-progress: false + path: plasma + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version-file: 'plasma/.nvmrc' + + - name: Install plasma web project deps + working-directory: ./plasma + run: npm ci + + - name: Install plasma-icons + working-directory: ./plasma + run: | + npx lerna bootstrap ${{ env.lerna-scope }} + + - name: Generate iOS icons + working-directory: ./plasma + run: | + npx lerna ${{ env.lerna-scope }} run generate:ios + + - name: Extract current version + id: extract_version + working-directory: ./current + shell: bash + run: | + VER=$(grep -A1 'CFBundleShortVersionString' ./SDDSIcons/info.plist | awk -F'[<>]' '/string/{print $3; exit}') + echo "CFBundleVersion is $VER" + echo "tag=SDDSIcons-v$VER" >> $GITHUB_OUTPUT + + - name: Verify release branch not exists + working-directory: ./current + shell: bash + run: | + git fetch --all + if git branch -a | grep -q release/${{ steps.extract_version.outputs.tag }}; then exit 1; else exit 0; fi + + - name: Create release branch + working-directory: ./current + shell: bash + run: | + git fetch --all + git checkout -b release/${{steps.extract_version.outputs.tag}} + + - name: Move generated icons to XCAssets + run: cp -rf plasma/packages/plasma-icons/icons-ios/. current/SDDSIcons/SDDSIcons/Assets.xcassets + + - name: Install SwiftGen + run: | + brew install swiftgen + + - name: Run SwiftGen + working-directory: ./current + run: | + cd SDDSIcons + swiftgen + + - name: Create tag and release pull request + working-directory: ./current + shell: bash + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + TAG=${{steps.extract_version.outputs.tag}} + PLASMA_VER=${{ github.event.client_payload.version || github.event.inputs.plasma-version }} + git config --local user.email "salutedevs@gmail.com" + git config --local user.name "Salute iOS Team" + git add ./SDDSIcons/SDDSIcons/Assets.xcassets/ + git add ./SDDSIcons/Generated/Assets.swift + git commit -m "feat(sdds-acore/icons): New icons were added from plasma v$PLASMA_VER" + git push --set-upstream origin release/$TAG + gh pr create --base main --head release/$TAG --title "Release $TAG" --body "Icons were updated to v$PLASMA_VER" diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/LICENCE.txt b/LICENCE.txt new file mode 100644 index 000000000..4ac192b87 --- /dev/null +++ b/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Salute Devices + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SDDSCore/LICENCE.txt b/SDDSCore/LICENCE.txt new file mode 100644 index 000000000..4ac192b87 --- /dev/null +++ b/SDDSCore/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Salute Devices + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SDDSDemoApp/LICENCE.txt b/SDDSDemoApp/LICENCE.txt new file mode 100644 index 000000000..4ac192b87 --- /dev/null +++ b/SDDSDemoApp/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Salute Devices + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.pbxproj b/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.pbxproj index ed7d75b51..f65902556 100644 --- a/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.pbxproj +++ b/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 242BF2452BBC616400E4D112 /* SDDSCore.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDA2BB5CE5100277123 /* SDDSCore.xcframework */; }; + 242BF2462BBC616400E4D112 /* SDDSCore.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDA2BB5CE5100277123 /* SDDSCore.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 2430DEE02BB5CE5100277123 /* SDDSIcons.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDB2BB5CE5100277123 /* SDDSIcons.xcframework */; }; 2430DEE12BB5CE5100277123 /* SDDSIcons.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDB2BB5CE5100277123 /* SDDSIcons.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 2430DEE22BB5CE5100277123 /* SDDSSwiftUI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DEDC2BB5CE5100277123 /* SDDSSwiftUI.xcframework */; }; @@ -48,6 +50,7 @@ files = ( 2430DEE52BB5CE5100277123 /* SDDSUIKit.xcframework in Embed Frameworks */, 2430DEE12BB5CE5100277123 /* SDDSIcons.xcframework in Embed Frameworks */, + 242BF2462BBC616400E4D112 /* SDDSCore.xcframework in Embed Frameworks */, 2430DEE32BB5CE5100277123 /* SDDSSwiftUI.xcframework in Embed Frameworks */, ); name = "Embed Frameworks"; @@ -79,6 +82,7 @@ files = ( 2430DEE42BB5CE5100277123 /* SDDSUIKit.xcframework in Frameworks */, 2430DEE02BB5CE5100277123 /* SDDSIcons.xcframework in Frameworks */, + 242BF2452BBC616400E4D112 /* SDDSCore.xcframework in Frameworks */, 2430DEE22BB5CE5100277123 /* SDDSSwiftUI.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/SDDSDemoApp/SDDSDemoApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@1x.png b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@1x.png new file mode 100644 index 000000000..8c0dcbaf6 Binary files /dev/null and b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@1x.png differ diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@2x.png b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@2x.png new file mode 100644 index 000000000..b5a27884b Binary files /dev/null and b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@2x.png differ diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@3x.png b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@3x.png new file mode 100644 index 000000000..993a0ad71 Binary files /dev/null and b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/AppleOutline@3x.png differ diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/Contents.json b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/Contents.json new file mode 100644 index 000000000..b64f48cc1 --- /dev/null +++ b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "info": { + "version": 1, + "author": "xcode" + }, + "images": [ + { + "scale": "1x", + "idiom": "universal", + "filename": "AppleOutline@1x.png" + }, + { + "scale": "2x", + "idiom": "universal", + "filename": "AppleOutline@2x.png" + }, + { + "scale": "3x", + "idiom": "universal", + "filename": "AppleOutline@3x.png" + } + ] +} \ No newline at end of file diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@1x.png b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@1x.png new file mode 100644 index 000000000..974005a9c Binary files /dev/null and b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@1x.png differ diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@2x.png b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@2x.png new file mode 100644 index 000000000..50aa166f9 Binary files /dev/null and b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@2x.png differ diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@3x.png b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@3x.png new file mode 100644 index 000000000..0dc5c8eb8 Binary files /dev/null and b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Accessibility@3x.png differ diff --git a/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Contents.json b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Contents.json new file mode 100644 index 000000000..09690fa18 --- /dev/null +++ b/SDDSDemoApp/SDDSDemoApp/Assets.xcassets/testIcon2.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Accessibility@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Accessibility@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Accessibility@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSDemoApp/SDDSDemoApp/ContentView.swift b/SDDSDemoApp/SDDSDemoApp/ContentView.swift index aafeef331..74954ee9b 100644 --- a/SDDSDemoApp/SDDSDemoApp/ContentView.swift +++ b/SDDSDemoApp/SDDSDemoApp/ContentView.swift @@ -1,13 +1,27 @@ import SwiftUI +import SDDSIcons struct ContentView: View { var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - Text("Hello, world!") + ZStack { + Color.red.opacity(0.3) + .ignoresSafeArea() + VStack { + if let bundle = bundle { + Image("testIcon2") + .fixedSize() + .frame(width: 100, height: 100) + .foregroundColor(.red) + } else { + Text("no bundle") + } + } + .padding() } - .padding() + } + + private var bundle: Bundle? { + Bundle(for: Icons.self) } } diff --git a/SDDSDemoApp/SDDSDemoApp/SDDSDemoApp.swift b/SDDSDemoApp/SDDSDemoApp/SDDSDemoApp.swift index a1b8edefe..0b92b2485 100644 --- a/SDDSDemoApp/SDDSDemoApp/SDDSDemoApp.swift +++ b/SDDSDemoApp/SDDSDemoApp/SDDSDemoApp.swift @@ -1,5 +1,5 @@ import SwiftUI -//import SDDSCore +import SDDSCore import SDDSUIKit import SDDSSwiftUI import SDDSIcons diff --git a/SDDSIcons.podspec b/SDDSIcons.podspec new file mode 100644 index 000000000..7abf524ef --- /dev/null +++ b/SDDSIcons.podspec @@ -0,0 +1,13 @@ +Pod::Spec.new do |s| +s.name = 'SDDSIcons' +s.version = '0.0.1' +s.summary = 'Salute design system. Assets library.' +s.description = 'Salute design system. Assets library.' +s.homepage = 'https://github.com/salute-developers/plasma-ios' +s.license = { :type => 'MIT', :file => 'LICENSE' } +s.author = { 'username' => 'vkasci@gmail.com' } +s.platform = :ios, "14.0" +s.source = { :http => 'https://github.com/salute-developers/plasma-ios/releases/download/0.0.1/SDDSIcons-v0.0.1.zip'} +s.ios.deployment_target = '14.0' +s.vendored_frameworks = 'SDDSIcons.xcframework' +end diff --git a/SDDSIcons/Generated/Assets.swift b/SDDSIcons/Generated/Assets.swift new file mode 100644 index 000000000..d548c81a0 --- /dev/null +++ b/SDDSIcons/Generated/Assets.swift @@ -0,0 +1,118 @@ +// swiftlint:disable all +// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen + + +#if os(iOS) + import UIKit +#elseif os(tvOS) || os(watchOS) + import UIKit +#endif +#if canImport(SwiftUI) + import SwiftUI +#endif + +// Deprecated typealiases +@available(*, deprecated, renamed: "ImageAsset.Image", message: "This typealias will be removed in SwiftGen 7.0") +public typealias AssetImageTypeAlias = ImageAsset.Image + +// swiftlint:disable superfluous_disable_command file_length implicit_return + +// MARK: - Asset Catalogs + +// swiftlint:disable identifier_name line_length nesting type_body_length type_name +public enum Asset { + public static let apple = ImageAsset(name: "Apple") + public static let google = ImageAsset(name: "Google") + public static let meta = ImageAsset(name: "Meta") + public static let microsoft = ImageAsset(name: "Microsoft") +} +// swiftlint:enable identifier_name line_length nesting type_body_length type_name + +// MARK: - Implementation Details + +public struct ImageAsset { + public fileprivate(set) var name: String + + #if os(iOS) || os(tvOS) || os(watchOS) + public typealias Image = UIImage + #endif + + @available(iOS 8.0, tvOS 9.0, watchOS 2.0, macOS 10.7, *) + public var uiImage: Image { + let bundle = BundleToken.bundle + #if os(iOS) || os(tvOS) + let image = Image(named: name, in: bundle, compatibleWith: nil) + #elseif os(watchOS) + let image = Image(named: name) + #endif + guard let result = image else { + fatalError("Unable to load image asset named \(name).") + } + return result + } + + #if os(iOS) || os(tvOS) + @available(iOS 8.0, tvOS 9.0, *) + public func image(compatibleWith traitCollection: UITraitCollection) -> Image { + let bundle = BundleToken.bundle + guard let result = Image(named: name, in: bundle, compatibleWith: traitCollection) else { + fatalError("Unable to load image asset named \(name).") + } + return result + } + #endif + + #if canImport(SwiftUI) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) + public var image: SwiftUI.Image { + SwiftUI.Image(asset: self) + } + #endif +} + +public extension ImageAsset.Image { + @available(iOS 8.0, tvOS 9.0, watchOS 2.0, *) + @available(macOS, deprecated, + message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") + convenience init?(asset: ImageAsset) { + #if os(iOS) || os(tvOS) + let bundle = BundleToken.bundle + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } +} + +#if canImport(SwiftUI) +@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) +public extension SwiftUI.Image { + init(asset: ImageAsset) { + let bundle = BundleToken.bundle + self.init(asset.name, bundle: bundle) + } + + init(asset: ImageAsset, label: Text) { + let bundle = BundleToken.bundle + self.init(asset.name, bundle: bundle, label: label) + } + + init(decorative asset: ImageAsset) { + let bundle = BundleToken.bundle + self.init(decorative: asset.name, bundle: bundle) + } +} +#endif + +// swiftlint:disable convenience_type +private final class BundleToken { + static let bundle: Bundle = { + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif + }() +} +// swiftlint:enable convenience_type + diff --git a/SDDSIcons/LICENCE.txt b/SDDSIcons/LICENCE.txt new file mode 100644 index 000000000..4ac192b87 --- /dev/null +++ b/SDDSIcons/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Salute Devices + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SDDSIcons/SDDSIcons.xcodeproj/project.pbxproj b/SDDSIcons/SDDSIcons.xcodeproj/project.pbxproj index 1ce4dc747..cefb2f4ff 100644 --- a/SDDSIcons/SDDSIcons.xcodeproj/project.pbxproj +++ b/SDDSIcons/SDDSIcons.xcodeproj/project.pbxproj @@ -6,7 +6,24 @@ objectVersion = 56; objects = { +/* Begin PBXAggregateTarget section */ + 242BF25E2BBDA0C300E4D112 /* Build XCFramework */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 242BF2612BBDA0C400E4D112 /* Build configuration list for PBXAggregateTarget "Build XCFramework" */; + buildPhases = ( + 242BF2622BBDA0CC00E4D112 /* Run Script */, + ); + dependencies = ( + ); + name = "Build XCFramework"; + productName = "Build XCFramework"; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ + 242BF2422BBC600D00E4D112 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 242BF2412BBC600D00E4D112 /* Assets.xcassets */; }; + 242BF2442BBC610200E4D112 /* SDDSIcons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 242BF2432BBC610200E4D112 /* SDDSIcons.swift */; }; + 242BF24F2BBC687700E4D112 /* Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 242BF24E2BBC687700E4D112 /* Assets.swift */; }; 2430DEA02BB5B53B00277123 /* SDDSIcons.docc in Sources */ = {isa = PBXBuildFile; fileRef = 2430DE9F2BB5B53B00277123 /* SDDSIcons.docc */; }; 2430DEA62BB5B53B00277123 /* SDDSIcons.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2430DE9B2BB5B53B00277123 /* SDDSIcons.framework */; }; 2430DEAB2BB5B53B00277123 /* SDDSIconsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2430DEAA2BB5B53B00277123 /* SDDSIconsTests.swift */; }; @@ -24,11 +41,20 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 242BF2412BBC600D00E4D112 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 242BF2432BBC610200E4D112 /* SDDSIcons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSIcons.swift; sourceTree = ""; }; + 242BF2472BBC673300E4D112 /* swiftgen.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = swiftgen.yml; sourceTree = ""; }; + 242BF24E2BBC687700E4D112 /* Assets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Assets.swift; sourceTree = ""; }; + 242BF2552BBD8AB000E4D112 /* assets.stencil */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = assets.stencil; sourceTree = ""; }; + 242BF2582BBD941D00E4D112 /* build_xcframework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = build_xcframework.sh; sourceTree = ""; }; + 242BF26B2BBDA47A00E4D112 /* SDDSIcons.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = SDDSIcons.xcframework; sourceTree = ""; }; + 242BF26E2BBDAE4A00E4D112 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 2430DE9B2BB5B53B00277123 /* SDDSIcons.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDDSIcons.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2430DE9E2BB5B53B00277123 /* SDDSIcons.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDDSIcons.h; sourceTree = ""; }; 2430DE9F2BB5B53B00277123 /* SDDSIcons.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = SDDSIcons.docc; sourceTree = ""; }; 2430DEA52BB5B53B00277123 /* SDDSIconsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SDDSIconsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 2430DEAA2BB5B53B00277123 /* SDDSIconsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSIconsTests.swift; sourceTree = ""; }; + 243C6C462BBF14E900525EAD /* info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -50,9 +76,48 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 242BF24D2BBC687700E4D112 /* Generated */ = { + isa = PBXGroup; + children = ( + 242BF24E2BBC687700E4D112 /* Assets.swift */, + ); + path = Generated; + sourceTree = ""; + }; + 242BF2542BBD8AB000E4D112 /* Templates */ = { + isa = PBXGroup; + children = ( + 242BF2552BBD8AB000E4D112 /* assets.stencil */, + ); + path = Templates; + sourceTree = ""; + }; + 242BF2572BBD940700E4D112 /* Scripts */ = { + isa = PBXGroup; + children = ( + 242BF2582BBD941D00E4D112 /* build_xcframework.sh */, + ); + path = Scripts; + sourceTree = ""; + }; + 242BF26A2BBDA47A00E4D112 /* build */ = { + isa = PBXGroup; + children = ( + 242BF26B2BBDA47A00E4D112 /* SDDSIcons.xcframework */, + ); + path = build; + sourceTree = ""; + }; 2430DE912BB5B53B00277123 = { isa = PBXGroup; children = ( + 243C6C462BBF14E900525EAD /* info.plist */, + 242BF26E2BBDAE4A00E4D112 /* Package.swift */, + 242BF2472BBC673300E4D112 /* swiftgen.yml */, + 242BF26A2BBDA47A00E4D112 /* build */, + 242BF24D2BBC687700E4D112 /* Generated */, + 242BF2572BBD940700E4D112 /* Scripts */, + 242BF2542BBD8AB000E4D112 /* Templates */, 2430DE9D2BB5B53B00277123 /* SDDSIcons */, 2430DEA92BB5B53B00277123 /* SDDSIconsTests */, 2430DE9C2BB5B53B00277123 /* Products */, @@ -73,6 +138,8 @@ children = ( 2430DE9E2BB5B53B00277123 /* SDDSIcons.h */, 2430DE9F2BB5B53B00277123 /* SDDSIcons.docc */, + 242BF2412BBC600D00E4D112 /* Assets.xcassets */, + 242BF2432BBC610200E4D112 /* SDDSIcons.swift */, ); path = SDDSIcons; sourceTree = ""; @@ -146,6 +213,9 @@ LastSwiftUpdateCheck = 1520; LastUpgradeCheck = 1520; TargetAttributes = { + 242BF25E2BBDA0C300E4D112 = { + CreatedOnToolsVersion = 15.2; + }; 2430DE9A2BB5B53B00277123 = { CreatedOnToolsVersion = 15.2; }; @@ -169,6 +239,7 @@ targets = ( 2430DE9A2BB5B53B00277123 /* SDDSIcons */, 2430DEA42BB5B53B00277123 /* SDDSIconsTests */, + 242BF25E2BBDA0C300E4D112 /* Build XCFramework */, ); }; /* End PBXProject section */ @@ -178,6 +249,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 242BF2422BBC600D00E4D112 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -191,8 +263,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 242BF2622BBDA0CC00E4D112 /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"${SRCROOT}/Scripts/build_xcframework.sh\"\n"; + }; 2430DEE72BB6B30700277123 /* Lint */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -216,7 +308,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 242BF2442BBC610200E4D112 /* SDDSIcons.swift in Sources */, 2430DEA02BB5B53B00277123 /* SDDSIcons.docc in Sources */, + 242BF24F2BBC687700E4D112 /* Assets.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -239,6 +333,24 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 242BF25F2BBDA0C400E4D112 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KDMYYG676V; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 242BF2602BBDA0C400E4D112 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KDMYYG676V; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; 2430DEAD2BB5B53B00277123 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -278,7 +390,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu17; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -345,7 +457,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu17; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -378,15 +490,17 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; - GENERATE_INFOPLIST_FILE = YES; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "${SRCROOT}/info.plist"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.0; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = com.sd.SDDSIcons; @@ -414,15 +528,17 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; - GENERATE_INFOPLIST_FILE = YES; + GENERATE_INFOPLIST_FILE = NO; + INFOPLIST_FILE = "${SRCROOT}/info.plist"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.0; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = com.sd.SDDSIcons; @@ -441,6 +557,7 @@ 2430DEB32BB5B53B00277123 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = KDMYYG676V; @@ -461,6 +578,7 @@ 2430DEB42BB5B53B00277123 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = KDMYYG676V; @@ -481,6 +599,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 242BF2612BBDA0C400E4D112 /* Build configuration list for PBXAggregateTarget "Build XCFramework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 242BF25F2BBDA0C400E4D112 /* Debug */, + 242BF2602BBDA0C400E4D112 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 2430DE952BB5B53B00277123 /* Build configuration list for PBXProject "SDDSIcons" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/SDDSIcons/SDDSIcons.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SDDSIcons/SDDSIcons.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/SDDSIcons/SDDSIcons.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@1x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@1x.png new file mode 100644 index 000000000..7b2412f66 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@1x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@2x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@2x.png new file mode 100644 index 000000000..4c83a4017 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@2x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@3x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@3x.png new file mode 100644 index 000000000..7c4cb28f4 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/AppleFill@3x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/Contents.json new file mode 100644 index 000000000..cb96d7e66 --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Apple.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AppleFill@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AppleFill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AppleFill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@1x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@1x.png new file mode 100644 index 000000000..7b2412f66 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@1x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@2x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@2x.png new file mode 100644 index 000000000..4c83a4017 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@2x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@3x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@3x.png new file mode 100644 index 000000000..7c4cb28f4 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/AppleFill@3x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/Contents.json new file mode 100644 index 000000000..cb96d7e66 --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Google 1.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AppleFill@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AppleFill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AppleFill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@1x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@1x.png new file mode 100644 index 000000000..7b2412f66 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@1x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@2x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@2x.png new file mode 100644 index 000000000..4c83a4017 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@2x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@3x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@3x.png new file mode 100644 index 000000000..7c4cb28f4 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/AppleFill@3x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/Contents.json new file mode 100644 index 000000000..cb96d7e66 --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Google.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AppleFill@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AppleFill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AppleFill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@1x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@1x.png new file mode 100644 index 000000000..7b2412f66 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@1x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@2x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@2x.png new file mode 100644 index 000000000..4c83a4017 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@2x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@3x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@3x.png new file mode 100644 index 000000000..7c4cb28f4 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/AppleFill@3x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/Contents.json new file mode 100644 index 000000000..cb96d7e66 --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta 1.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AppleFill@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AppleFill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AppleFill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@1x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@1x.png new file mode 100644 index 000000000..7b2412f66 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@1x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@2x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@2x.png new file mode 100644 index 000000000..4c83a4017 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@2x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@3x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@3x.png new file mode 100644 index 000000000..7c4cb28f4 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/AppleFill@3x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/Contents.json new file mode 100644 index 000000000..cb96d7e66 --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Meta.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AppleFill@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AppleFill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AppleFill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@1x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@1x.png new file mode 100644 index 000000000..7b2412f66 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@1x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@2x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@2x.png new file mode 100644 index 000000000..4c83a4017 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@2x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@3x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@3x.png new file mode 100644 index 000000000..7c4cb28f4 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/AppleFill@3x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/Contents.json new file mode 100644 index 000000000..cb96d7e66 --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft 1.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AppleFill@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AppleFill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AppleFill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@1x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@1x.png new file mode 100644 index 000000000..7b2412f66 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@1x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@2x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@2x.png new file mode 100644 index 000000000..4c83a4017 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@2x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@3x.png b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@3x.png new file mode 100644 index 000000000..7c4cb28f4 Binary files /dev/null and b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/AppleFill@3x.png differ diff --git a/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/Contents.json b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/Contents.json new file mode 100644 index 000000000..cb96d7e66 --- /dev/null +++ b/SDDSIcons/SDDSIcons/Assets.xcassets/Microsoft.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "AppleFill@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "AppleFill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "AppleFill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SDDSIcons/SDDSIcons/SDDSIcons.swift b/SDDSIcons/SDDSIcons/SDDSIcons.swift new file mode 100644 index 000000000..8d623d042 --- /dev/null +++ b/SDDSIcons/SDDSIcons/SDDSIcons.swift @@ -0,0 +1,5 @@ +import Foundation + +public final class Icons { + +} diff --git a/SDDSIcons/Scripts/build_xcframework.sh b/SDDSIcons/Scripts/build_xcframework.sh new file mode 100755 index 000000000..0fd010b62 --- /dev/null +++ b/SDDSIcons/Scripts/build_xcframework.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +PROJECT_ROOT_DIR="$(dirname "$0")/.." +PROJECT_ROOT_DIR=$(cd "$PROJECT_ROOT_DIR" && pwd) +echo "Root directory is ${PROJECT_ROOT_DIR}" + +BUILD_FOLDER="build" +BUILD_PATH="${PROJECT_ROOT_DIR}/${BUILD_FOLDER}" + +echo "Artefacts will appear in ${BUILD_PATH}" + +rm -rf "${BUILD_PATH}" +mkdir -p "${BUILD_PATH}" + +SCHEME="SDDSIcons" + +echo "Building XCFrameworks for ${SCHEME}" + +XCODE_PROJECT_PATH="${PROJECT_ROOT_DIR}/${SCHEME}.xcodeproj" + +echo "Building XCFramework for the scheme $SCHEME" + +echo "Making an archive for iOS device..." +iOS_ARCHIVE_PATH="${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive" +SKIP_LINT=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + +echo "Making an archive for iOS simulator..." +iOS_SIMULATOR_ARCHIVE_PATH="${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive" +SKIP_LINT=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + +echo "Making XCFramework..." +SKIP_LINT=YES xcodebuild -create-xcframework -framework "${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -framework "${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -output "${BUILD_PATH}/${SCHEME}.xcframework" + +if [ $? -ne 0 ]; then + echo "Build failed for the scheme $SCHEME." + exit 1 +else + echo "Build succeeded for the scheme $SCHEME" +fi + +echo "Cleaning up archives..." +rm -rf "${iOS_ARCHIVE_PATH}" +rm -rf "${iOS_SIMULATOR_ARCHIVE_PATH}" + +echo "All builds succeeded" diff --git a/SDDSIcons/Templates/assets.stencil b/SDDSIcons/Templates/assets.stencil new file mode 100644 index 000000000..bd2c40605 --- /dev/null +++ b/SDDSIcons/Templates/assets.stencil @@ -0,0 +1,424 @@ +// swiftlint:disable all +// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen + +{% if catalogs %} +{% macro hasValuesBlock assets filter %} + {%- for asset in assets -%} + {%- if asset.type == filter -%} + 1 + {%- elif asset.items -%} + {% call hasValuesBlock asset.items filter %} + {%- endif -%} + {%- endfor -%} +{% endmacro %} +{% set enumName %}{{param.enumName|default:"Asset"}}{% endset %} +{% set arResourceGroupType %}{{param.arResourceGroupTypeName|default:"ARResourceGroupAsset"}}{% endset %} +{% set colorType %}{{param.colorTypeName|default:"ColorAsset"}}{% endset %} +{% set dataType %}{{param.dataTypeName|default:"DataAsset"}}{% endset %} +{% set imageType %}{{param.imageTypeName|default:"ImageAsset"}}{% endset %} +{% set symbolType %}{{param.symbolTypeName|default:"SymbolAsset"}}{% endset %} +{% set forceNamespaces %}{{param.forceProvidesNamespaces|default:"false"}}{% endset %} +{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} +{% set hasARResourceGroup %}{% for catalog in catalogs %}{% call hasValuesBlock catalog.assets "arresourcegroup" %}{% endfor %}{% endset %} +{% set hasColor %}{% for catalog in catalogs %}{% call hasValuesBlock catalog.assets "color" %}{% endfor %}{% endset %} +{% set hasData %}{% for catalog in catalogs %}{% call hasValuesBlock catalog.assets "data" %}{% endfor %}{% endset %} +{% set hasImage %}{% for catalog in catalogs %}{% call hasValuesBlock catalog.assets "image" %}{% endfor %}{% endset %} +{% set hasSymbol %}{% for catalog in catalogs %}{% call hasValuesBlock catalog.assets "symbol" %}{% endfor %}{% endset %} + +#if os(iOS) +{% if hasARResourceGroup %} + import ARKit +{% endif %} + import UIKit +#elseif os(tvOS) || os(watchOS) + import UIKit +#endif +#if canImport(SwiftUI) + import SwiftUI +#endif + +// Deprecated typealiases +{% if hasColor %} +@available(*, deprecated, renamed: "{{colorType}}.Color", message: "This typealias will be removed in SwiftGen 7.0") +{{accessModifier}} typealias {{param.colorAliasName|default:"AssetColorTypeAlias"}} = {{colorType}}.Color +{% endif %} +{% if hasImage %} +@available(*, deprecated, renamed: "{{imageType}}.Image", message: "This typealias will be removed in SwiftGen 7.0") +{{accessModifier}} typealias {{param.imageAliasName|default:"AssetImageTypeAlias"}} = {{imageType}}.Image +{% endif %} + +// swiftlint:disable superfluous_disable_command file_length implicit_return + +// MARK: - Asset Catalogs + +{% macro enumBlock assets %} + {% call casesBlock assets %} + {% if param.allValues %} + + // swiftlint:disable trailing_comma + {% set hasItems %}{% call hasValuesBlock assets "arresourcegroup" %}{% endset %} + {% if hasItems %} + @available(*, deprecated, message: "All values properties are now deprecated") + {{accessModifier}} static let allResourceGroups: [{{arResourceGroupType}}] = [ + {% filter indent:2," ",true %}{% call allValuesBlock assets "arresourcegroup" "" %}{% endfilter %} + ] + {% endif %} + {% set hasItems %}{% call hasValuesBlock assets "color" %}{% endset %} + {% if hasItems %} + @available(*, deprecated, message: "All values properties are now deprecated") + {{accessModifier}} static let allColors: [{{colorType}}] = [ + {% filter indent:2," ",true %}{% call allValuesBlock assets "color" "" %}{% endfilter %} + ] + {% endif %} + {% set hasItems %}{% call hasValuesBlock assets "data" %}{% endset %} + {% if hasItems %} + @available(*, deprecated, message: "All values properties are now deprecated") + {{accessModifier}} static let allDataAssets: [{{dataType}}] = [ + {% filter indent:2," ",true %}{% call allValuesBlock assets "data" "" %}{% endfilter %} + ] + {% endif %} + {% set hasItems %}{% call hasValuesBlock assets "image" %}{% endset %} + {% if hasItems %} + @available(*, deprecated, message: "All values properties are now deprecated") + {{accessModifier}} static let allImages: [{{imageType}}] = [ + {% filter indent:2," ",true %}{% call allValuesBlock assets "image" "" %}{% endfilter %} + ] + {% endif %} + {% set hasItems %}{% call hasValuesBlock assets "symbol" %}{% endset %} + {% if hasItems %} + @available(*, deprecated, message: "All values properties are now deprecated") + {{accessModifier}} static let allSymbols: [{{symbolType}}] = [ + {% filter indent:2," ",true %}{% call allValuesBlock assets "symbol" "" %}{% endfilter %} + ] + {% endif %} + // swiftlint:enable trailing_comma + {% endif %} +{% endmacro %} +{% macro casesBlock assets %} + {% for asset in assets %} + {% if asset.type == "arresourcegroup" %} + {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{arResourceGroupType}}(name: "{{asset.value}}") + {% elif asset.type == "color" %} + {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{colorType}}(name: "{{asset.value}}") + {% elif asset.type == "data" %} + {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{dataType}}(name: "{{asset.value}}") + {% elif asset.type == "image" %} + {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{imageType}}(name: "{{asset.value}}") + {% elif asset.type == "symbol" %} + {{accessModifier}} static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = {{symbolType}}(name: "{{asset.value}}") + {% elif asset.items and ( forceNamespaces == "true" or asset.isNamespaced == "true" ) %} + {{accessModifier}} enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {% filter indent:2," ",true %}{% call casesBlock asset.items %}{% endfilter %} + } + {% elif asset.items %} + {% call casesBlock asset.items %} + {% endif %} + {% endfor %} +{% endmacro %} +{% macro allValuesBlock assets filter prefix %} + {% for asset in assets %} + {% if asset.type == filter %} + {{prefix}}{{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}, + {% elif asset.items and ( forceNamespaces == "true" or asset.isNamespaced == "true" ) %} + {% set prefix2 %}{{prefix}}{{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}.{% endset %} + {% call allValuesBlock asset.items filter prefix2 %} + {% elif asset.items %} + {% call allValuesBlock asset.items filter prefix %} + {% endif %} + {% endfor %} +{% endmacro %} +// swiftlint:disable identifier_name line_length nesting type_body_length type_name +{{accessModifier}} enum {{enumName}} { + {% if catalogs.count > 1 or param.forceFileNameEnum %} + {% for catalog in catalogs %} + {{accessModifier}} enum {{catalog.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} { + {% if catalog.assets %} + {% filter indent:2," ",true %}{% call enumBlock catalog.assets %}{% endfilter %} + {% endif %} + } + {% endfor %} + {% else %} + {% call enumBlock catalogs.first.assets %} + {% endif %} +} +// swiftlint:enable identifier_name line_length nesting type_body_length type_name + +// MARK: - Implementation Details +{% if hasARResourceGroup %} + +{{accessModifier}} struct {{arResourceGroupType}} { + {{accessModifier}} fileprivate(set) var name: String + + #if os(iOS) + @available(iOS 11.3, *) + {{accessModifier}} var referenceImages: Set { + return ARReferenceImage.referenceImages(in: self) + } + + @available(iOS 12.0, *) + {{accessModifier}} var referenceObjects: Set { + return ARReferenceObject.referenceObjects(in: self) + } + #endif +} + +#if os(iOS) +@available(iOS 11.3, *) +{{accessModifier}} extension ARReferenceImage { + static func referenceImages(in asset: {{arResourceGroupType}}) -> Set { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + return referenceImages(inGroupNamed: asset.name, bundle: bundle) ?? Set() + } +} + +@available(iOS 12.0, *) +{{accessModifier}} extension ARReferenceObject { + static func referenceObjects(in asset: {{arResourceGroupType}}) -> Set { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + return referenceObjects(inGroupNamed: asset.name, bundle: bundle) ?? Set() + } +} +#endif +{% endif %} +{% if hasColor %} + +{{accessModifier}} final class {{colorType}} { + {{accessModifier}} fileprivate(set) var name: String + + #if os(iOS) || os(tvOS) || os(watchOS) + {{accessModifier}} typealias Color = UIColor + #endif + + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *) + {{accessModifier}} private(set) lazy var color: Color = { + guard let color = Color(asset: self) else { + fatalError("Unable to load color asset named \(name).") + } + return color + }() + + #if os(iOS) || os(tvOS) + @available(iOS 11.0, tvOS 11.0, *) + {{accessModifier}} func color(compatibleWith traitCollection: UITraitCollection) -> Color { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + guard let color = Color(named: name, in: bundle, compatibleWith: traitCollection) else { + fatalError("Unable to load color asset named \(name).") + } + return color + } + #endif + + #if canImport(SwiftUI) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) + {{accessModifier}} private(set) lazy var swiftUIColor: SwiftUI.Color = { + SwiftUI.Color(asset: self) + }() + #endif + + fileprivate init(name: String) { + self.name = name + } +} + +{{accessModifier}} extension {{colorType}}.Color { + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *) + convenience init?(asset: {{colorType}}) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + #if os(iOS) || os(tvOS) + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } +} + +#if canImport(SwiftUI) +@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) +{{accessModifier}} extension SwiftUI.Color { + init(asset: {{colorType}}) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(asset.name, bundle: bundle) + } +} +#endif +{% endif %} +{% if hasData %} + +{{accessModifier}} struct {{dataType}} { + {{accessModifier}} fileprivate(set) var name: String + + @available(iOS 9.0, tvOS 9.0, watchOS 6.0, macOS 10.11, *) + {{accessModifier}} var data: NSDataAsset { + guard let data = NSDataAsset(asset: self) else { + fatalError("Unable to load data asset named \(name).") + } + return data + } +} + +@available(iOS 9.0, tvOS 9.0, watchOS 6.0, macOS 10.11, *) +{{accessModifier}} extension NSDataAsset { + convenience init?(asset: {{dataType}}) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + #if os(iOS) || os(tvOS) || os(watchOS) + self.init(name: asset.name, bundle: bundle) + #endif + } +} +{% endif %} +{% if hasImage %} + +{{accessModifier}} struct {{imageType}} { + {{accessModifier}} fileprivate(set) var name: String + + #if os(iOS) || os(tvOS) || os(watchOS) + {{accessModifier}} typealias Image = UIImage + #endif + + @available(iOS 8.0, tvOS 9.0, watchOS 2.0, macOS 10.7, *) + {{accessModifier}} var uiImage: Image { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + #if os(iOS) || os(tvOS) + let image = Image(named: name, in: bundle, compatibleWith: nil) + #elseif os(watchOS) + let image = Image(named: name) + #endif + guard let result = image else { + fatalError("Unable to load image asset named \(name).") + } + return result + } + + #if os(iOS) || os(tvOS) + @available(iOS 8.0, tvOS 9.0, *) + {{accessModifier}} func image(compatibleWith traitCollection: UITraitCollection) -> Image { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + guard let result = Image(named: name, in: bundle, compatibleWith: traitCollection) else { + fatalError("Unable to load image asset named \(name).") + } + return result + } + #endif + + #if canImport(SwiftUI) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) + {{accessModifier}} var image: SwiftUI.Image { + SwiftUI.Image(asset: self) + } + #endif +} + +{{accessModifier}} extension {{imageType}}.Image { + @available(iOS 8.0, tvOS 9.0, watchOS 2.0, *) + @available(macOS, deprecated, + message: "This initializer is unsafe on macOS, please use the {{imageType}}.image property") + convenience init?(asset: {{imageType}}) { + #if os(iOS) || os(tvOS) + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } +} + +#if canImport(SwiftUI) +@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) +{{accessModifier}} extension SwiftUI.Image { + init(asset: {{imageType}}) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(asset.name, bundle: bundle) + } + + init(asset: {{imageType}}, label: Text) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(asset.name, bundle: bundle, label: label) + } + + init(decorative asset: {{imageType}}) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(decorative: asset.name, bundle: bundle) + } +} +#endif +{% endif %} +{% if hasSymbol %} + +{{accessModifier}} struct {{symbolType}} { + {{accessModifier}} fileprivate(set) var name: String + + #if os(iOS) || os(tvOS) || os(watchOS) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) + {{accessModifier}} typealias Configuration = UIImage.SymbolConfiguration + {{accessModifier}} typealias Image = UIImage + + @available(iOS 12.0, tvOS 12.0, watchOS 5.0, *) + {{accessModifier}} var image: Image { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + #if os(iOS) || os(tvOS) + let image = Image(named: name, in: bundle, compatibleWith: nil) + #elseif os(watchOS) + let image = Image(named: name) + #endif + guard let result = image else { + fatalError("Unable to load symbol asset named \(name).") + } + return result + } + + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) + {{accessModifier}} func image(with configuration: Configuration) -> Image { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + guard let result = Image(named: name, in: bundle, with: configuration) else { + fatalError("Unable to load symbol asset named \(name).") + } + return result + } + #endif + + #if canImport(SwiftUI) + @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) + {{accessModifier}} var swiftUIImage: SwiftUI.Image { + SwiftUI.Image(asset: self) + } + #endif +} + +#if canImport(SwiftUI) +@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *) +{{accessModifier}} extension SwiftUI.Image { + init(asset: {{symbolType}}) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(asset.name, bundle: bundle) + } + + init(asset: {{symbolType}}, label: Text) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(asset.name, bundle: bundle, label: label) + } + + init(decorative asset: {{symbolType}}) { + let bundle = {{param.bundle|default:"BundleToken.bundle"}} + self.init(decorative: asset.name, bundle: bundle) + } +} +#endif +{% endif %} +{% if not param.bundle %} + +// swiftlint:disable convenience_type +private final class BundleToken { + static let bundle: Bundle = { + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif + }() +} +// swiftlint:enable convenience_type +{% endif %} +{% else %} +// No assets found +{% endif %} + diff --git a/SDDSIcons/info.plist b/SDDSIcons/info.plist new file mode 100644 index 000000000..a32053afc --- /dev/null +++ b/SDDSIcons/info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleShortVersionString + 1.0.0 + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleName + $(PRODUCT_NAME) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + NSHumanReadableCopyright + + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + + diff --git a/SDDSIcons/swiftgen.yml b/SDDSIcons/swiftgen.yml new file mode 100644 index 000000000..8aad4360b --- /dev/null +++ b/SDDSIcons/swiftgen.yml @@ -0,0 +1,57 @@ +## Note: all of the config entries below are just examples with placeholders. Be sure to edit and adjust to your needs when uncommenting. + +## In case your config entries all use a common input/output parent directory, you can specify those here. +## Every input/output paths in the rest of the config will then be expressed relative to these. +## Those two top-level keys are optional and default to "." (the directory of the config file). +# input_dir: MyLib/Sources/ +# output_dir: MyLib/Generated/ + + +## Generate constants for your localized strings. +## Be sure that SwiftGen only parses ONE locale (typically Base.lproj, or en.lproj, or whichever your development region is); otherwise it will generate the same keys multiple times. +## SwiftGen will parse all `.strings` files found in that folder. +# strings: +# inputs: +# - Resources/Base.lproj +# outputs: +# - templateName: structured-swift5 +# output: Strings+Generated.swift + + +## Generate constants for your Assets Catalogs, including constants for images, colors, ARKit resources, etc. +## This example also shows how to provide additional parameters to your template to customize the output. +## - Especially the `forceProvidesNamespaces: true` param forces to create sub-namespace for each folder/group used in your Asset Catalogs, even the ones without "Provides Namespace". Without this param, SwiftGen only generates sub-namespaces for folders/groups which have the "Provides Namespace" box checked in the Inspector pane. +## - To know which params are supported for a template, use `swiftgen template doc xcassets swift5` to open the template documentation on GitHub. + xcassets: + inputs: + - SDDSIcons/Assets.xcassets + outputs: + - templatePath: Templates/assets.stencil + params: + forceProvidesNamespaces: true + publicAccess: true + output: Generated/Assets.swift + +## Generate constants for your storyboards and XIBs. +## This one generates 2 output files, one containing the storyboard scenes, and another for the segues. +## (You can remove the segues entry if you don't use segues in your IB files). +## For `inputs` we can use "." here (aka "current directory", at least relative to `input_dir` = "MyLib/Sources"), +## and SwiftGen will recursively find all `*.storyboard` and `*.xib` files in there. +# ib: +# inputs: +# - . +# outputs: +# - templateName: scenes-swift5 +# output: IB-Scenes+Generated.swift +# - templateName: segues-swift5 +# output: IB-Segues+Generated.swift + + +## There are other parsers available for you to use depending on your needs, for example: +## - `fonts` (if you have custom ttf/ttc font files) +## - `coredata` (for CoreData models) +## - `json`, `yaml` and `plist` (to parse custom JSON/YAML/Plist files and generate code from their content) +## … +## +## For more info, use `swiftgen config doc` to open the full documentation on GitHub. +## https://github.com/SwiftGen/SwiftGen/tree/6.6.3/Documentation/ diff --git a/SDDSSwiftUI/LICENCE.txt b/SDDSSwiftUI/LICENCE.txt new file mode 100644 index 000000000..4ac192b87 --- /dev/null +++ b/SDDSSwiftUI/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Salute Devices + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SDDSUIKit/LICENCE.txt b/SDDSUIKit/LICENCE.txt new file mode 100644 index 000000000..4ac192b87 --- /dev/null +++ b/SDDSUIKit/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Salute Devices + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SddsIcons/Package.swift b/SddsIcons/Package.swift deleted file mode 100644 index 9ca52c8dd..000000000 --- a/SddsIcons/Package.swift +++ /dev/null @@ -1,23 +0,0 @@ -// swift-tools-version: 5.9 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "SddsIcons", - products: [ - // Products define the executables and libraries a package produces, making them visible to other packages. - .library( - name: "SddsIcons", - targets: ["SddsIcons"]), - ], - targets: [ - // Targets are the basic building blocks of a package, defining a module or a test suite. - // Targets can depend on other targets in this package and products from dependencies. - .target( - name: "SddsIcons"), - .testTarget( - name: "SddsIconsTests", - dependencies: ["SddsIcons"]), - ] -) diff --git a/scripts/build.sh b/scripts/build.sh index 4d6fc81dd..a01733e35 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -28,14 +28,14 @@ for MODULE in "${!modules[@]}"; do print_info "Making an archive for iOS device..." iOS_ARCHIVE_PATH="${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive" - SKIP_LINT=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + SKIP_LINT=YES BUILD_ALL=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES print_info "Making an archive for iOS simulator..." iOS_SIMULATOR_ARCHIVE_PATH="${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive" - SKIP_LINT=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + SKIP_LINT=YES BUILD_ALL=YES xcodebuild archive -project ${XCODE_PROJECT_PATH} -scheme ${SCHEME} -archivePath "${iOS_SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES print_info "Making XCFramework..." - SKIP_LINT=YES xcodebuild -create-xcframework -framework "${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -framework "${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -output "${BUILD_PATH}/${SCHEME}.xcframework" + SKIP_LINT=YES BUILD_ALL=YES xcodebuild -create-xcframework -framework "${BUILD_PATH}/${SCHEME}-iphoneos.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -framework "${BUILD_PATH}/${SCHEME}-iossimulator.xcarchive/Products/Library/Frameworks/${SCHEME}.framework" -output "${BUILD_PATH}/${SCHEME}.xcframework" if [ $? -ne 0 ]; then print_error "Build failed for the scheme $SCHEME."