diff --git a/.swift-version b/.swift-version new file mode 100644 index 00000000..a75b92f1 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +5.1 diff --git a/.travis.yml b/.travis.yml index 92b60622..36476bbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,10 @@ branches: - develop git: quiet: true -osx_image: xcode10.1 +osx_image: xcode11 xcode_workspace: Speculid.xcworkspace xcode_scheme: Speculid-Mac-App +xcode_destination: platform=macOS install: - bundler install - pod repo update --silent diff --git a/Gemfile.lock b/Gemfile.lock index 418f6b84..7c9fdafb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,47 +1,52 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.6) - activesupport (4.2.10) + CFPropertyList (3.0.1) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.0) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) atomos (0.1.3) - claide (1.0.2) - clamp (0.6.5) - cocoapods (1.5.3) + claide (1.0.3) + clamp (1.3.1) + cocoapods (1.8.0) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.5.3) - cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.0, < 2.0) + cocoapods-core (= 1.8.0) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.0, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.5) + molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.1) - xcodeproj (>= 1.5.7, < 2.0) - cocoapods-core (1.5.3) + ruby-macho (~> 1.4) + xcodeproj (>= 1.11.1, < 2.0) + cocoapods-core (1.8.0) activesupport (>= 4.0.2, < 6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.0) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) + cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) - cocoapods-trunk (1.3.1) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.4.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) @@ -53,43 +58,43 @@ GEM colored2 (3.1.2) commonmarker (0.17.13) ruby-enum (~> 0.5) - concurrent-ruby (1.1.2) - dnsruby (1.61.2) + concurrent-ruby (1.1.5) + dnsruby (1.61.3) addressable (~> 2.5) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) escape (0.0.4) - ethon (0.11.0) + ethon (0.12.0) ffi (>= 1.3.0) eventmachine (1.2.7) execjs (2.7.0) - faraday (0.15.3) + faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.9.25) + ffi (1.11.1) forwardable-extended (2.6.0) - fourflusher (2.0.1) + fourflusher (2.3.1) fuzzy_match (2.0.4) - gemoji (3.0.0) + gemoji (3.0.1) gh_inspector (1.1.3) - github-pages (192) - activesupport (= 4.2.10) - github-pages-health-check (= 1.8.1) - jekyll (= 3.7.4) + github-pages (200) + activesupport (= 4.2.11.1) + github-pages-health-check (= 1.16.1) + jekyll (= 3.8.5) jekyll-avatar (= 0.6.0) jekyll-coffeescript (= 1.1.1) jekyll-commonmark-ghpages (= 0.1.5) jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.10.0) + jekyll-feed (= 0.11.0) jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.9.4) + jekyll-github-metadata (= 2.12.1) jekyll-mentions (= 1.4.1) jekyll-optional-front-matter (= 0.3.0) jekyll-paginate (= 1.1.0) jekyll-readme-index (= 0.2.0) jekyll-redirect-from (= 0.14.0) - jekyll-relative-links (= 0.5.3) - jekyll-remote-theme (= 0.3.1) + jekyll-relative-links (= 0.6.0) + jekyll-remote-theme (= 0.4.0) jekyll-sass-converter (= 1.5.2) jekyll-seo-tag (= 2.5.0) jekyll-sitemap (= 1.2.0) @@ -108,28 +113,29 @@ GEM jekyll-theme-tactile (= 0.1.1) jekyll-theme-time-machine (= 0.1.1) jekyll-titles-from-headings (= 0.5.1) - jemoji (= 0.10.1) + jemoji (= 0.10.2) kramdown (= 1.17.0) liquid (= 4.0.0) listen (= 3.1.5) mercenary (~> 0.3) minima (= 2.5.0) - nokogiri (>= 1.8.2, < 2.0) + nokogiri (>= 1.10.4, < 2.0) rouge (= 2.2.1) terminal-table (~> 1.4) - github-pages-health-check (1.8.1) + github-pages-health-check (1.16.1) addressable (~> 2.3) dnsruby (~> 1.60) octokit (~> 4.0) - public_suffix (~> 2.0) + public_suffix (~> 3.0) typhoeus (~> 1.3) - html-pipeline (2.8.4) + html-pipeline (2.12.0) activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.6.0) + httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - jekyll (3.7.4) + jekyll (3.8.5) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) @@ -147,21 +153,21 @@ GEM jekyll-coffeescript (1.1.1) coffee-script (~> 2.2) coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.2.0) + jekyll-commonmark (1.3.1) commonmarker (~> 0.14) - jekyll (>= 3.0, < 4.0) + jekyll (>= 3.7, < 5.0) jekyll-commonmark-ghpages (0.1.5) commonmarker (~> 0.17.6) jekyll-commonmark (~> 1) rouge (~> 2) jekyll-default-layout (0.1.4) jekyll (~> 3.0) - jekyll-feed (0.10.0) + jekyll-feed (0.11.0) jekyll (~> 3.3) jekyll-gist (1.5.0) octokit (~> 4.2) - jekyll-github-metadata (2.9.4) - jekyll (~> 3.1) + jekyll-github-metadata (2.12.1) + jekyll (~> 3.4) octokit (~> 4.0, != 4.4.0) jekyll-mentions (1.4.1) html-pipeline (~> 2.3) @@ -173,9 +179,10 @@ GEM jekyll (~> 3.0) jekyll-redirect-from (0.14.0) jekyll (~> 3.3) - jekyll-relative-links (0.5.3) + jekyll-relative-links (0.6.0) jekyll (~> 3.3) - jekyll-remote-theme (0.3.1) + jekyll-remote-theme (0.4.0) + addressable (~> 2.0) jekyll (~> 3.5) rubyzip (>= 1.2.1, < 3.0) jekyll-sass-converter (1.5.2) @@ -227,12 +234,13 @@ GEM jekyll-seo-tag (~> 2.0) jekyll-titles-from-headings (0.5.1) jekyll (~> 3.3) - jekyll-watch (2.1.2) + jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.10.1) + jemoji (0.10.2) gemoji (~> 3.0) html-pipeline (~> 2.2) jekyll (~> 3.0) + json (2.2.0) kramdown (1.17.0) liquid (4.0.0) listen (3.1.5) @@ -240,48 +248,48 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) - mini_portile2 (2.3.0) + mini_portile2 (2.4.0) minima (2.5.0) jekyll (~> 3.5) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.11.3) + minitest (5.12.0) molinillo (0.6.6) - multipart-post (2.0.0) + multipart-post (2.1.1) nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - nokogiri (1.8.5) - mini_portile2 (~> 2.3.0) - octokit (4.13.0) + nokogiri (1.10.4) + mini_portile2 (~> 2.4.0) + octokit (4.14.0) sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (2.0.5) + public_suffix (3.1.1) rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) + rb-inotify (0.10.0) + ffi (~> 1.0) rouge (2.2.1) ruby-enum (0.7.2) i18n - ruby-macho (1.3.1) + ruby-macho (1.4.0) ruby_dep (1.5.0) - rubyzip (1.2.2) - safe_yaml (1.0.4) - sass (3.7.0) + rubyzip (1.2.4) + safe_yaml (1.0.5) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) - slather (2.4.6) - CFPropertyList (~> 2.2) - activesupport (>= 4.0.2) - clamp (~> 0.6) - nokogiri (~> 1.8.2) - xcodeproj (~> 1.4) + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) + slather (2.4.7) + CFPropertyList (>= 2.2, < 4) + activesupport (>= 4.0.2, < 5) + clamp (~> 1.3) + nokogiri (~> 1.8) + xcodeproj (~> 1.7) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) @@ -289,8 +297,8 @@ GEM ethon (>= 0.9.0) tzinfo (1.2.5) thread_safe (~> 0.1) - unicode-display_width (1.4.0) - xcodeproj (1.7.0) + unicode-display_width (1.6.0) + xcodeproj (1.12.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -306,4 +314,4 @@ DEPENDENCIES slather BUNDLED WITH - 1.17.1 + 1.17.2 diff --git a/Podfile b/Podfile index 0f35a384..0d8e12cb 100644 --- a/Podfile +++ b/Podfile @@ -17,6 +17,7 @@ target 'CairoSVG' do end + target 'Speculid' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! @@ -24,11 +25,16 @@ target 'Speculid' do # Pods for Speculid pod 'SwiftVer' - target 'SpeculidTests' do - inherit! :search_paths - # Pods for testing - end + + +end +target 'SpeculidTests' do + # Comment the next line if you're not using Swift and don't want to use dynamic frameworks + use_frameworks! + + # Pods for Speculid + pod 'SwiftVer' end target 'Speculid-Mac-App' do diff --git a/Podfile.lock b/Podfile.lock index 11d85899..a76a3d58 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,6 +1,6 @@ PODS: - - SwiftFormat/CLI (0.35.6) - - SwiftLint (0.27.0) + - SwiftFormat/CLI (0.40.12) + - SwiftLint (0.35.0) - SwiftVer (2.0.4) DEPENDENCIES: @@ -9,16 +9,16 @@ DEPENDENCIES: - SwiftVer SPEC REPOS: - https://github.com/cocoapods/specs.git: + https://github.com/CocoaPods/Specs.git: - SwiftFormat - SwiftLint - SwiftVer SPEC CHECKSUMS: - SwiftFormat: 92cd208b201c0a44dd65657280df42c37950261b - SwiftLint: 3207c1faa2240bf8973b191820a116113cd11073 + SwiftFormat: 73667bbb741386b0febf0bd1a1b8c502aa9d1c98 + SwiftLint: 5553187048b900c91aa03552807681bb6b027846 SwiftVer: 85fca0c0087660e0b07fe021efdd4b794046e465 -PODFILE CHECKSUM: 2ecd26879e8bf7a7ac71ae7dbb51d7fe0d3d478d +PODFILE CHECKSUM: 432b032d04411cede9e0269a79b2d07c89f85f01 -COCOAPODS: 1.5.3 +COCOAPODS: 1.8.0 diff --git a/Speculid.xcodeproj/project.pbxproj b/Speculid.xcodeproj/project.pbxproj index 8d154b8d..9daa5bd0 100644 --- a/Speculid.xcodeproj/project.pbxproj +++ b/Speculid.xcodeproj/project.pbxproj @@ -76,6 +76,7 @@ B3136EB01F9124730002B7AB /* svg-trayicon.speculid in Resources */ = {isa = PBXBuildFile; fileRef = B3136EA21F910BC90002B7AB /* svg-trayicon.speculid */; }; B317B0D11FA560EE00BB5E57 /* QuitMenuItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B317B0D01FA560EE00BB5E57 /* QuitMenuItem.swift */; }; B318906A1F918F0300D0EFA0 /* GeometryValue.Multiply.swift in Sources */ = {isa = PBXBuildFile; fileRef = B31890691F918F0300D0EFA0 /* GeometryValue.Multiply.swift */; }; + B319DCB1233BE09700F9381E /* AssetCatalogItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B319DCAF233BE00400F9381E /* AssetCatalogItem.swift */; }; B31BD6EA20E7A6A400A560C2 /* libffi.6.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = B3F8074120E5855F00030497 /* libffi.6.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; B31BD91520E7E0D800A560C2 /* translit.h in Headers */ = {isa = PBXBuildFile; fileRef = B31BD70020E7E0D500A560C2 /* translit.h */; }; B31BD91620E7E0D800A560C2 /* ustdio.h in Headers */ = {isa = PBXBuildFile; fileRef = B31BD70120E7E0D500A560C2 /* ustdio.h */; }; @@ -742,6 +743,12 @@ B3E9A9031FB4DDE400FD8E7A /* Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3E9A9021FB4DDE400FD8E7A /* Version.swift */; }; B3F0ECF01F9E6A4D0078690E /* SpeculidImageSpecificationBuilderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F0ECEF1F9E6A4D0078690E /* SpeculidImageSpecificationBuilderProtocol.swift */; }; B3F0ECF21F9E6AAD0078690E /* SpeculidImageSpecificationBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F0ECF11F9E6AAD0078690E /* SpeculidImageSpecificationBuilder.swift */; }; + B3F6E279233C3BF100B28DA2 /* AssetSpecificationFileProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F6E278233C3BF100B28DA2 /* AssetSpecificationFileProtocol.swift */; }; + B3F6E27B233C3DC400B28DA2 /* AssetSpecificationFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F6E27A233C3DC400B28DA2 /* AssetSpecificationFile.swift */; }; + B3F6E27D233C3EE100B28DA2 /* AssetCatalogItemSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F6E27C233C3EE100B28DA2 /* AssetCatalogItemSize.swift */; }; + B3F6E27F233C3F0C00B28DA2 /* NSNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F6E27E233C3F0C00B28DA2 /* NSNumber.swift */; }; + B3F6E281233C3F2E00B28DA2 /* AssetSpecificationMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F6E280233C3F2E00B28DA2 /* AssetSpecificationMetadata.swift */; }; + B3F6E283233C3F7300B28DA2 /* AssetSpecificationMetadataProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F6E282233C3F7300B28DA2 /* AssetSpecificationMetadataProtocol.swift */; }; B3F804D420E5820B00030497 /* pango.h in Headers */ = {isa = PBXBuildFile; fileRef = B3F8046220E5820B00030497 /* pango.h */; }; B3F804D520E5820B00030497 /* pangoft2.h in Headers */ = {isa = PBXBuildFile; fileRef = B3F8046320E5820B00030497 /* pangoft2.h */; }; B3F804D620E5820B00030497 /* pango-item.h in Headers */ = {isa = PBXBuildFile; fileRef = B3F8046420E5820B00030497 /* pango-item.h */; }; @@ -1161,6 +1168,7 @@ B317B0D01FA560EE00BB5E57 /* QuitMenuItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuitMenuItem.swift; sourceTree = ""; }; B31890691F918F0300D0EFA0 /* GeometryValue.Multiply.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeometryValue.Multiply.swift; sourceTree = ""; }; B318906D1F91A06B00D0EFA0 /* .swiftlint.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = ""; }; + B319DCAF233BE00400F9381E /* AssetCatalogItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetCatalogItem.swift; sourceTree = ""; }; B31BD70020E7E0D500A560C2 /* translit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = translit.h; sourceTree = ""; }; B31BD70120E7E0D500A560C2 /* ustdio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ustdio.h; sourceTree = ""; }; B31BD70220E7E0D500A560C2 /* utf_old.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf_old.h; sourceTree = ""; }; @@ -1836,6 +1844,12 @@ B3E9A9041FB4E0B200FD8E7A /* bin */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bin; sourceTree = ""; }; B3F0ECEF1F9E6A4D0078690E /* SpeculidImageSpecificationBuilderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeculidImageSpecificationBuilderProtocol.swift; sourceTree = ""; }; B3F0ECF11F9E6AAD0078690E /* SpeculidImageSpecificationBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeculidImageSpecificationBuilder.swift; sourceTree = ""; }; + B3F6E278233C3BF100B28DA2 /* AssetSpecificationFileProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetSpecificationFileProtocol.swift; sourceTree = ""; }; + B3F6E27A233C3DC400B28DA2 /* AssetSpecificationFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetSpecificationFile.swift; sourceTree = ""; }; + B3F6E27C233C3EE100B28DA2 /* AssetCatalogItemSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetCatalogItemSize.swift; sourceTree = ""; }; + B3F6E27E233C3F0C00B28DA2 /* NSNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSNumber.swift; sourceTree = ""; }; + B3F6E280233C3F2E00B28DA2 /* AssetSpecificationMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetSpecificationMetadata.swift; sourceTree = ""; }; + B3F6E282233C3F7300B28DA2 /* AssetSpecificationMetadataProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetSpecificationMetadataProtocol.swift; sourceTree = ""; }; B3F8046220E5820B00030497 /* pango.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pango.h; sourceTree = ""; }; B3F8046320E5820B00030497 /* pangoft2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pangoft2.h; sourceTree = ""; }; B3F8046420E5820B00030497 /* pango-item.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "pango-item.h"; sourceTree = ""; }; @@ -2225,6 +2239,7 @@ B3136DF61F90F73A0002B7AB /* NSColor.swift */, B3136DF71F90F73A0002B7AB /* String.swift */, B3E9A9021FB4DDE400FD8E7A /* Version.swift */, + B3F6E27E233C3F0C00B28DA2 /* NSNumber.swift */, ); path = Extensions; sourceTree = ""; @@ -2235,21 +2250,26 @@ B3136E051F90F73A0002B7AB /* AnalyticsConfiguration.swift */, B3136DFA1F90F73A0002B7AB /* AnalyticsParameterDictionary.swift */, B3136E021F90F73A0002B7AB /* AnalyticsParameterKey.swift */, + B319DCAF233BE00400F9381E /* AssetCatalogItem.swift */, B3136E041F90F73A0002B7AB /* AssetSpecification.swift */, B3033B1F1F9AEFE600787279 /* AssetSpecificationDocument.swift */, B341888D1F9A460300C5F356 /* CommandLineArgumentProvider.swift */, - B3136DC91F90E2A20002B7AB /* ErrorCollection.swift */, B3891BBD20F7CE010095E1FD /* CwlSysctl.swift */, + B3136DC91F90E2A20002B7AB /* ErrorCollection.swift */, B3136DBB1F90E27B0002B7AB /* ImageFile.swift */, B3136E071F90F73A0002B7AB /* ImageIdiom.swift */, B3136DBE1F90E27B0002B7AB /* ImageSpecification.swift */, + B34B52C7217E5D700080E6DC /* InstallType.swift */, B33A533D1F954FF800E74800 /* Result.swift */, B3B5E9DF1F96C416004A6BEB /* SpeculidApplicationMode.swift */, B3B5E9E11F96C44D004A6BEB /* SpeculidCommandArgumentSet.swift */, B3B5E9DD1F96C2A2004A6BEB /* SpeculidConfiguration.swift */, B3136E011F90F73A0002B7AB /* SpeculidDocument.swift */, B3136DFC1F90F73A0002B7AB /* SpeculidSpecificationsFile.swift */, - B34B52C7217E5D700080E6DC /* InstallType.swift */, + B3F6E278233C3BF100B28DA2 /* AssetSpecificationFileProtocol.swift */, + B3F6E27A233C3DC400B28DA2 /* AssetSpecificationFile.swift */, + B3F6E27C233C3EE100B28DA2 /* AssetCatalogItemSize.swift */, + B3F6E280233C3F2E00B28DA2 /* AssetSpecificationMetadata.swift */, ); path = Models; sourceTree = ""; @@ -2288,6 +2308,7 @@ B3F0ECEF1F9E6A4D0078690E /* SpeculidImageSpecificationBuilderProtocol.swift */, B3CB156F2113AA8C00A6DC5C /* VersionProvider.swift */, B3FDF6442180A3FF00455A43 /* InstallerProtocol.swift */, + B3F6E282233C3F7300B28DA2 /* AssetSpecificationMetadataProtocol.swift */, ); path = Protocols; sourceTree = ""; @@ -4780,7 +4801,7 @@ B3136E7A1F90FD2E0002B7AB /* Sources */, B3136E7B1F90FD2E0002B7AB /* Frameworks */, B3136E7C1F90FD2E0002B7AB /* Resources */, - C467F507FA1A90CD666AC710 /* [CP] Embed Pods Frameworks */, + AB8615DAE34FEF509F2B61FF /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -4950,27 +4971,33 @@ TargetAttributes = { B3136E5F1F90FCCF0002B7AB = { CreatedOnToolsVersion = 9.0; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; TestTargetID = B37C743D1F8C58F300DF505B; }; B3136E7D1F90FD2E0002B7AB = { CreatedOnToolsVersion = 9.0; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; }; B3136E8C1F90FD3D0002B7AB = { CreatedOnToolsVersion = 9.0; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; }; B3242E96213DBE6C0063037C = { CreatedOnToolsVersion = 10.0; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; }; B326F24E21811B970072D652 = { CreatedOnToolsVersion = 10.0; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; }; B37C743D1F8C58F300DF505B = { CreatedOnToolsVersion = 9.0; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.HardenedRuntime = { @@ -4983,7 +5010,7 @@ }; B37C74521F8C590D00DF505B = { CreatedOnToolsVersion = 9.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.HardenedRuntime = { @@ -4993,7 +5020,7 @@ }; B37C74721F8C5ADA00DF505B = { CreatedOnToolsVersion = 9.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1110; ProvisioningStyle = Automatic; }; B37C74881F8C5B5C00DF505B = { @@ -5200,6 +5227,24 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + AB8615DAE34FEF509F2B61FF /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SpeculidTests/Pods-SpeculidTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/SwiftVer/SwiftVer.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftVer.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SpeculidTests/Pods-SpeculidTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; B3136E9C1F9100CB0002B7AB /* Autorevision */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -5226,7 +5271,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" \"${SRCROOT}/frameworks\" --disable trailingCommas --indent 2 --allman false --removelines enabled --header strip --insertlines disabled --empty void --ranges spaced --trimwhitespace always --linebreaks lf --commas always --comments indent --ifdef indent --hexliterals uppercase --semicolons inline"; + shellScript = "\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" \"${SRCROOT}/frameworks\" --disable trailingCommas --indent 2 --allman false --removelines enabled --header strip --insertlines disabled --empty void --ranges spaced --trimwhitespace always --linebreaks lf --commas always --comments indent --ifdef indent --hexliterals uppercase --semicolons inline\n"; }; B318906C1F91A02000D0EFA0 /* swiftlint */ = { isa = PBXShellScriptBuildPhase; @@ -5363,31 +5408,13 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - C467F507FA1A90CD666AC710 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-SpeculidTests/Pods-SpeculidTests-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/SwiftVer/SwiftVer.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftVer.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SpeculidTests/Pods-SpeculidTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; F11FED44F4FDA27EB1AD0F15 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Speculid-Mac-App/Pods-Speculid-Mac-App-frameworks.sh", + "${PODS_ROOT}/Target Support Files/Pods-Speculid-Mac-App/Pods-Speculid-Mac-App-frameworks.sh", "${BUILT_PRODUCTS_DIR}/SwiftVer/SwiftVer.framework", ); name = "[CP] Embed Pods Frameworks"; @@ -5396,7 +5423,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Speculid-Mac-App/Pods-Speculid-Mac-App-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Speculid-Mac-App/Pods-Speculid-Mac-App-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -5467,6 +5494,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B3F6E27B233C3DC400B28DA2 /* AssetSpecificationFile.swift in Sources */, B3B5E9E41F96C5F1004A6BEB /* CommandLineActivityProtocol.swift in Sources */, B3891BBE20F7CE010095E1FD /* CwlSysctl.swift in Sources */, B3136E3D1F90F73B0002B7AB /* AnalyticsParameterKey.swift in Sources */, @@ -5482,6 +5510,7 @@ B3136E461F90F73B0002B7AB /* ImageConversionTaskProtocol.swift in Sources */, B3136E3C1F90F73B0002B7AB /* SpeculidDocument.swift in Sources */, B3B5E9E21F96C44D004A6BEB /* SpeculidCommandArgumentSet.swift in Sources */, + B3F6E27D233C3EE100B28DA2 /* AssetCatalogItemSize.swift in Sources */, B33F0BB91F958695004A87DD /* RemoteObjectInterfaceProvider.swift in Sources */, B33F0BB61F958640004A87DD /* StatusItemProviderProtocol.swift in Sources */, B34B52C8217E5D700080E6DC /* InstallType.swift in Sources */, @@ -5518,6 +5547,7 @@ B3E9A9031FB4DDE400FD8E7A /* Version.swift in Sources */, B3136E531F90F73B0002B7AB /* SpeculidBuilderProtocol.swift in Sources */, B3136E4B1F90F73B0002B7AB /* SpeculidConfigurationProtocol.swift in Sources */, + B3F6E281233C3F2E00B28DA2 /* AssetSpecificationMetadata.swift in Sources */, B3136E4A1F90F73B0002B7AB /* SpeculidDocumentProtocol.swift in Sources */, B3033B201F9AEFE600787279 /* AssetSpecificationDocument.swift in Sources */, B3136E4F1F90F73B0002B7AB /* GeometryProtocol.swift in Sources */, @@ -5538,8 +5568,10 @@ B3136E541F90F73B0002B7AB /* ApplicationProtocol.swift in Sources */, B3CB15702113AA8C00A6DC5C /* VersionProvider.swift in Sources */, B3B5E9DA1F96C1C1004A6BEB /* SpeculidConfigurationBuilder.swift in Sources */, + B3F6E27F233C3F0C00B28DA2 /* NSNumber.swift in Sources */, B34B52CA217E5FC40080E6DC /* CommandLineInstaller.swift in Sources */, B341888A1F9A44A700C5F356 /* CommandLineArgumentProviderProtocol.swift in Sources */, + B319DCB1233BE09700F9381E /* AssetCatalogItem.swift in Sources */, B33A533E1F954FF800E74800 /* Result.swift in Sources */, B3136E591F90F73B0002B7AB /* ArrayError.swift in Sources */, B3136E2E1F90F73B0002B7AB /* AnalyticsSessionManager.swift in Sources */, @@ -5549,8 +5581,10 @@ B3136E3B1F90F73B0002B7AB /* GeometryDimension.ScalingBy.swift in Sources */, B3B5E9EA1F96C777004A6BEB /* SpeculidApplicationModeParserProtocol.swift in Sources */, B3136E471F90F73B0002B7AB /* ClientIdentifierDelegate.swift in Sources */, + B3F6E283233C3F7300B28DA2 /* AssetSpecificationMetadataProtocol.swift in Sources */, B3136DCE1F90E45F0002B7AB /* ErrorCollection.swift in Sources */, B3136E271F90F73B0002B7AB /* AnalyticsTracker.swift in Sources */, + B3F6E279233C3BF100B28DA2 /* AssetSpecificationFileProtocol.swift in Sources */, B3B5E9DC1F96C1D2004A6BEB /* SpeculidConfigurationBuilderProtocol.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -5620,7 +5654,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.Speculid-Mac-AppUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_TARGET_NAME = "Speculid-Mac-App"; }; name = Debug; @@ -5639,7 +5673,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.Speculid-Mac-AppUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_TARGET_NAME = "Speculid-Mac-App"; }; name = Release; @@ -5658,7 +5692,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.SpeculidTests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -5676,7 +5710,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.SpeculidTests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -5694,7 +5728,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.CairoSVGTests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -5712,7 +5746,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.brightdigit.CairoSVGTests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -5726,7 +5760,7 @@ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_NAME = speculid; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -5739,7 +5773,7 @@ INSTALL_PATH = ""; MTL_FAST_MATH = YES; PRODUCT_NAME = speculid; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -5768,7 +5802,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -5796,7 +5830,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -5835,7 +5869,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = "$(DEFAULT_BUNDLE_VERSION)"; DEBUG_INFORMATION_FORMAT = dwarf; - DEFAULT_BUNDLE_VERSION = 5; + DEFAULT_BUNDLE_VERSION = 6; DEFAULT_SEMVER_VERSION = 2.0.0; DYLIB_COMPATIBILITY_VERSION = "$(DEFAULT_BUNDLE_VERSION)"; DYLIB_CURRENT_VERSION = "$(DEFAULT_BUNDLE_VERSION)"; @@ -5900,7 +5934,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = "$(DEFAULT_BUNDLE_VERSION)"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFAULT_BUNDLE_VERSION = 5; + DEFAULT_BUNDLE_VERSION = 6; DEFAULT_SEMVER_VERSION = 2.0.0; DYLIB_COMPATIBILITY_VERSION = "$(DEFAULT_BUNDLE_VERSION)"; DYLIB_CURRENT_VERSION = "$(DEFAULT_BUNDLE_VERSION)"; @@ -5939,7 +5973,7 @@ PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(PROJECT_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -5960,7 +5994,7 @@ PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(PROJECT_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -5982,7 +6016,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -6003,7 +6037,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -6026,7 +6060,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)Kit"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -6050,7 +6084,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.Speculid-Mac-Framework"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)Kit"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/Speculid.xcodeproj/xcshareddata/xcschemes/Speculid-Mac-App.xcscheme b/Speculid.xcodeproj/xcshareddata/xcschemes/Speculid-Mac-App.xcscheme index a9da4d76..03f3f99c 100644 --- a/Speculid.xcodeproj/xcshareddata/xcschemes/Speculid-Mac-App.xcscheme +++ b/Speculid.xcodeproj/xcshareddata/xcschemes/Speculid-Mac-App.xcscheme @@ -26,9 +26,18 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES" - onlyGenerateCoverageForSpecifiedTargets = "YES" - shouldUseLaunchSchemeArgsEnv = "YES"> + onlyGenerateCoverageForSpecifiedTargets = "YES"> + + + + - - - - - - + isEnabled = "NO"> + isEnabled = "YES"> + isEnabled = "NO"> @@ -154,8 +152,6 @@ isEnabled = "NO"> - - - - diff --git a/Speculid.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Speculid.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index 0c67376e..00000000 --- a/Speculid.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/applications/command/main.swift b/applications/command/main.swift index 601657c6..2aed6512 100644 --- a/applications/command/main.swift +++ b/applications/command/main.swift @@ -94,7 +94,7 @@ DispatchQueue.main.async { if let index = CommandLine.arguments.firstIndex(of: "--useLocation") { var tempArguments = CommandLine.arguments applicationPathURL = URL(fileURLWithPath: CommandLine.arguments[index + 1]) - tempArguments.removeSubrange((index ... index + 1)) + tempArguments.removeSubrange(index ... index + 1) arguments = tempArguments } else { applicationPathURL = nil diff --git a/applications/installer/ServiceDelegate.swift b/applications/installer/ServiceDelegate.swift index eccc25a9..1e3013c6 100644 --- a/applications/installer/ServiceDelegate.swift +++ b/applications/installer/ServiceDelegate.swift @@ -36,7 +36,7 @@ public class Installer: NSObject, InstallerProtocol { let binDirExists = FileManager.default.fileExists(atPath: binDirectoryURL.path, isDirectory: &isDirectory) - guard isDirectory.boolValue && binDirExists else { + guard isDirectory.boolValue, binDirExists else { return completed(InstallerError.error(fromCode: .usrLocalBinDirNotFound)) } diff --git a/applications/installer/Speculid-Mac-Installer-Info.plist b/applications/installer/Speculid-Mac-Installer-Info.plist index 6752f75e..ae9842d6 100644 --- a/applications/installer/Speculid-Mac-Installer-Info.plist +++ b/applications/installer/Speculid-Mac-Installer-Info.plist @@ -14,7 +14,7 @@ $(DEFAULT_BUNDLE_VERSION) SMAuthorizedClients - anchor apple generic and identifier "com.brightdigit.Speculid-Mac-App" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = MLT7M394S7) + identifier "com.brightdigit.Speculid-Mac-App" and anchor apple generic and Invalid Mac Developer CN: Apple Development: Leo Dion (5VZ4KT69B9) and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ diff --git a/applications/mac/Info.plist b/applications/mac/Info.plist index 5b4fe661..31ce4176 100644 --- a/applications/mac/Info.plist +++ b/applications/mac/Info.plist @@ -33,7 +33,7 @@ SMPrivilegedExecutables com.brightdigit.Speculid-Mac-Installer - anchor apple generic and identifier "com.brightdigit.Speculid-Mac-Installer" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = MLT7M394S7) + identifier "com.brightdigit.Speculid-Mac-Installer" and anchor apple generic and Invalid Mac Developer CN: Apple Development: Leo Dion (5VZ4KT69B9) and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ diff --git a/applications/xpc/ServiceDelegate.swift b/applications/xpc/ServiceDelegate.swift index d507fbb3..747c1a4e 100644 --- a/applications/xpc/ServiceDelegate.swift +++ b/applications/xpc/ServiceDelegate.swift @@ -5,9 +5,12 @@ import SpeculidKit @objc open class ServiceDelegate: NSObject, NSXPCListenerDelegate { public func listener(_: NSXPCListener, shouldAcceptNewConnection newConnection: NSXPCConnection) -> Bool { let exportedInterface = NSXPCInterface(with: ServiceProtocol.self) - let currentClasses: NSSet = exportedInterface.classes(for: #selector(ServiceProtocol.exportImageAtURL(_:toSpecifications:_:)), argumentIndex: 1, ofReply: false) as NSSet - let classes = currentClasses.addingObjects(from: [ImageSpecification.self, ImageFile.self, NSURL.self, NSColor.self]) + let currentClasses: NSSet = exportedInterface.classes(for: #selector(ServiceProtocol.exportImageAtURL(_:toSpecifications:_:)), argumentIndex: 1, ofReply: false).union( + exportedInterface.classes(for: #selector(ServiceProtocol.updateAssetCatalogAtURL(_:withItems:_:)), argumentIndex: 1, ofReply: false) + ) as NSSet + let classes = currentClasses.addingObjects(from: [ImageSpecification.self, ImageFile.self, NSURL.self, NSColor.self, AssetCatalogItem.self, AssetCatalogItemSize.self]) exportedInterface.setClasses(classes, for: #selector(ServiceProtocol.exportImageAtURL(_:toSpecifications:_:)), argumentIndex: 1, ofReply: false) + exportedInterface.setClasses(classes, for: #selector(ServiceProtocol.updateAssetCatalogAtURL(_:withItems:_:)), argumentIndex: 1, ofReply: false) newConnection.exportedInterface = exportedInterface let exportedObject = Service() newConnection.exportedObject = exportedObject diff --git a/examples/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json index 9dbbe286..7b83461e 100644 --- a/examples/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/examples/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -122,19 +122,19 @@ }, { "size" : "24x24", - "idiom" : "watch", - "filename" : "geometry.24x24@2x~watch.png", - "scale" : "2x", "role" : "notificationCenter", - "subtype" : "38mm" + "filename" : "geometry.24x24@2x~watch.png", + "idiom" : "watch", + "subtype" : "38mm", + "scale" : "2x" }, { "size" : "27.5x27.5", - "idiom" : "watch", - "filename" : "geometry.27.5x27.5@2x~watch.png", - "scale" : "2x", "role" : "notificationCenter", - "subtype" : "42mm" + "filename" : "geometry.27.5x27.5@2x~watch.png", + "idiom" : "watch", + "subtype" : "42mm", + "scale" : "2x" }, { "size" : "29x29", @@ -152,51 +152,51 @@ }, { "size" : "40x40", - "idiom" : "watch", - "filename" : "geometry.40x40@2x~watch.png", - "scale" : "2x", "role" : "appLauncher", - "subtype" : "38mm" + "filename" : "geometry.40x40@2x~watch.png", + "idiom" : "watch", + "subtype" : "38mm", + "scale" : "2x" }, { "size" : "44x44", - "idiom" : "watch", - "filename" : "geometry.44x44@2x~watch.png", - "scale" : "2x", "role" : "appLauncher", - "subtype" : "40mm" + "filename" : "geometry.44x44@2x~watch.png", + "idiom" : "watch", + "subtype" : "40mm", + "scale" : "2x" }, { "size" : "50x50", - "idiom" : "watch", - "filename" : "geometry.50x50@2x~watch.png", - "scale" : "2x", "role" : "appLauncher", - "subtype" : "44mm" + "filename" : "geometry.50x50@2x~watch.png", + "idiom" : "watch", + "subtype" : "44mm", + "scale" : "2x" }, { "size" : "86x86", - "idiom" : "watch", - "filename" : "geometry.86x86@2x~watch.png", - "scale" : "2x", "role" : "quickLook", - "subtype" : "38mm" + "filename" : "geometry.86x86@2x~watch.png", + "idiom" : "watch", + "subtype" : "38mm", + "scale" : "2x" }, { "size" : "98x98", - "idiom" : "watch", - "filename" : "geometry.98x98@2x~watch.png", - "scale" : "2x", "role" : "quickLook", - "subtype" : "42mm" + "filename" : "geometry.98x98@2x~watch.png", + "idiom" : "watch", + "subtype" : "42mm", + "scale" : "2x" }, { "size" : "108x108", - "idiom" : "watch", - "filename" : "geometry.108x108@2x~watch.png", - "scale" : "2x", "role" : "quickLook", - "subtype" : "44mm" + "filename" : "geometry.108x108@2x~watch.png", + "idiom" : "watch", + "subtype" : "44mm", + "scale" : "2x" }, { "size" : "1024x1024", @@ -267,6 +267,6 @@ ], "info" : { "version" : 1, - "author" : "xcode" + "author" : "com.brightdigit.Speculid" } } \ No newline at end of file diff --git a/examples/Assets/Assets.xcassets/ImageSet.imageset/Contents.json b/examples/Assets/Assets.xcassets/ImageSet.imageset/Contents.json index 6420beee..15081d05 100644 --- a/examples/Assets/Assets.xcassets/ImageSet.imageset/Contents.json +++ b/examples/Assets/Assets.xcassets/ImageSet.imageset/Contents.json @@ -5,23 +5,23 @@ "filename" : "geometry.pdf" }, { - "idiom" : "universal", + "scale" : "1x", "filename" : "geometry.1x~universal.png", - "scale" : "1x" + "idiom" : "universal" }, { - "idiom" : "universal", + "scale" : "2x", "filename" : "geometry.2x~universal.png", - "scale" : "2x" + "idiom" : "universal" }, { - "idiom" : "universal", + "scale" : "3x", "filename" : "geometry.3x~universal.png", - "scale" : "3x" + "idiom" : "universal" } ], "info" : { "version" : 1, - "author" : "xcode" + "author" : "com.brightdigit.Speculid" } } \ No newline at end of file diff --git a/examples/Assets/Assets.xcassets/ImageSetScaled.imageset/Contents.json b/examples/Assets/Assets.xcassets/ImageSetScaled.imageset/Contents.json index d8d3232a..f8f827e4 100644 --- a/examples/Assets/Assets.xcassets/ImageSetScaled.imageset/Contents.json +++ b/examples/Assets/Assets.xcassets/ImageSetScaled.imageset/Contents.json @@ -2,17 +2,14 @@ "images" : [ { "idiom" : "universal", - "filename" : "geometry.1x~universal.png", "scale" : "1x" }, { "idiom" : "universal", - "filename" : "geometry.2x~universal.png", "scale" : "2x" }, { "idiom" : "universal", - "filename" : "geometry.3x~universal.png", "scale" : "3x" } ], diff --git a/examples/Assets/Assets.xcassets/iOS AppIcon.appiconset/Contents.json b/examples/Assets/Assets.xcassets/iOS AppIcon.appiconset/Contents.json index 6a9f9b99..8ff0e123 100644 --- a/examples/Assets/Assets.xcassets/iOS AppIcon.appiconset/Contents.json +++ b/examples/Assets/Assets.xcassets/iOS AppIcon.appiconset/Contents.json @@ -3,103 +3,86 @@ { "size" : "20x20", "idiom" : "iphone", - "filename" : "layers.20x20@2x~iphone.png", "scale" : "2x" }, { "size" : "20x20", "idiom" : "iphone", - "filename" : "layers.20x20@3x~iphone.png", "scale" : "3x" }, { "size" : "29x29", "idiom" : "iphone", - "filename" : "layers.29x29@2x~iphone.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", - "filename" : "layers.29x29@3x~iphone.png", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", - "filename" : "layers.40x40@2x~iphone.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", - "filename" : "layers.40x40@3x~iphone.png", "scale" : "3x" }, { "size" : "60x60", "idiom" : "iphone", - "filename" : "layers.60x60@2x~iphone.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", - "filename" : "layers.60x60@3x~iphone.png", "scale" : "3x" }, { "size" : "20x20", "idiom" : "ipad", - "filename" : "layers.20x20@1x~ipad.png", "scale" : "1x" }, { "size" : "20x20", "idiom" : "ipad", - "filename" : "layers.20x20@2x~ipad.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "ipad", - "filename" : "layers.29x29@1x~ipad.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "ipad", - "filename" : "layers.29x29@2x~ipad.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "ipad", - "filename" : "layers.40x40@1x~ipad.png", "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", - "filename" : "layers.40x40@2x~ipad.png", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", - "filename" : "layers.76x76@1x~ipad.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", - "filename" : "layers.76x76@2x~ipad.png", "scale" : "2x" }, { "size" : "83.5x83.5", "idiom" : "ipad", - "filename" : "layers.83.5x83.5@2x~ipad.png", "scale" : "2x" }, { @@ -110,7 +93,6 @@ { "size" : "24x24", "idiom" : "watch", - "filename" : "layers.24x24@2x~watch.png", "scale" : "2x", "role" : "notificationCenter", "subtype" : "38mm" @@ -118,7 +100,6 @@ { "size" : "27.5x27.5", "idiom" : "watch", - "filename" : "layers.27.5x27.5@2x~watch.png", "scale" : "2x", "role" : "notificationCenter", "subtype" : "42mm" @@ -126,21 +107,18 @@ { "size" : "29x29", "idiom" : "watch", - "filename" : "layers.29x29@2x~watch.png", "role" : "companionSettings", "scale" : "2x" }, { "size" : "29x29", "idiom" : "watch", - "filename" : "layers.29x29@3x~watch.png", "role" : "companionSettings", "scale" : "3x" }, { "size" : "40x40", "idiom" : "watch", - "filename" : "layers.40x40@2x~watch.png", "scale" : "2x", "role" : "appLauncher", "subtype" : "38mm" @@ -162,7 +140,6 @@ { "size" : "86x86", "idiom" : "watch", - "filename" : "layers.86x86@2x~watch.png", "scale" : "2x", "role" : "quickLook", "subtype" : "38mm" @@ -170,7 +147,6 @@ { "size" : "98x98", "idiom" : "watch", - "filename" : "layers.98x98@2x~watch.png", "scale" : "2x", "role" : "quickLook", "subtype" : "42mm" diff --git a/examples/Assets/Assets.xcassets/macOS AppIcon.appiconset/Contents.json b/examples/Assets/Assets.xcassets/macOS AppIcon.appiconset/Contents.json index 6b2b49aa..ee01a1c6 100644 --- a/examples/Assets/Assets.xcassets/macOS AppIcon.appiconset/Contents.json +++ b/examples/Assets/Assets.xcassets/macOS AppIcon.appiconset/Contents.json @@ -3,61 +3,51 @@ { "size" : "16x16", "idiom" : "mac", - "filename" : "layers.16x16@1x~mac.png", "scale" : "1x" }, { "size" : "16x16", "idiom" : "mac", - "filename" : "layers.16x16@2x~mac.png", "scale" : "2x" }, { "size" : "32x32", "idiom" : "mac", - "filename" : "layers.32x32@1x~mac.png", "scale" : "1x" }, { "size" : "32x32", "idiom" : "mac", - "filename" : "layers.32x32@2x~mac.png", "scale" : "2x" }, { "size" : "128x128", "idiom" : "mac", - "filename" : "layers.128x128@1x~mac.png", "scale" : "1x" }, { "size" : "128x128", "idiom" : "mac", - "filename" : "layers.128x128@2x~mac.png", "scale" : "2x" }, { "size" : "256x256", "idiom" : "mac", - "filename" : "layers.256x256@1x~mac.png", "scale" : "1x" }, { "size" : "256x256", "idiom" : "mac", - "filename" : "layers.256x256@2x~mac.png", "scale" : "2x" }, { "size" : "512x512", "idiom" : "mac", - "filename" : "layers.512x512@1x~mac.png", "scale" : "1x" }, { "size" : "512x512", "idiom" : "mac", - "filename" : "layers.512x512@2x~mac.png", "scale" : "2x" } ], diff --git a/examples/examples.xcodeproj/project.pbxproj b/examples/examples.xcodeproj/project.pbxproj index b33fbdb8..565e56f7 100644 --- a/examples/examples.xcodeproj/project.pbxproj +++ b/examples/examples.xcodeproj/project.pbxproj @@ -411,7 +411,8 @@ }; B38F736C1DA2B37B008469FE = { CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Manual; + DevelopmentTeam = Z8V865KE5D; + ProvisioningStyle = Automatic; }; B38F73801DA2B38C008469FE = { CreatedOnToolsVersion = 8.0; @@ -436,6 +437,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -745,6 +747,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -777,6 +780,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -830,7 +834,6 @@ SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -876,7 +879,6 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; }; name = Release; }; @@ -902,8 +904,11 @@ CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = Z8V865KE5D; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -925,10 +930,10 @@ MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.speculid-example-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -955,8 +960,11 @@ CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = Z8V865KE5D; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -972,9 +980,9 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.brightdigit.speculid-example-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -1031,7 +1039,6 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -1080,7 +1087,6 @@ SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; VALIDATE_PRODUCT = YES; WATCHOS_DEPLOYMENT_TARGET = 2.0; @@ -1139,7 +1145,6 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -1189,7 +1194,6 @@ SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; VALIDATE_PRODUCT = YES; WATCHOS_DEPLOYMENT_TARGET = 2.0; diff --git a/examples/macos/Base.lproj/MainMenu.xib b/examples/macos/Base.lproj/MainMenu.xib index 9108cc8e..b887ac2f 100644 --- a/examples/macos/Base.lproj/MainMenu.xib +++ b/examples/macos/Base.lproj/MainMenu.xib @@ -1,7 +1,9 @@ - - + + - + + + @@ -11,7 +13,7 @@ - + @@ -627,7 +629,7 @@ - + @@ -677,12 +679,13 @@ + - + diff --git a/frameworks/speculid/Controllers/Application.swift b/frameworks/speculid/Controllers/Application.swift index 86ecc245..d248c3da 100644 --- a/frameworks/speculid/Controllers/Application.swift +++ b/frameworks/speculid/Controllers/Application.swift @@ -28,17 +28,17 @@ open class Application: NSApplication, ApplicationProtocol { return try SpeculidDocument(url: url, decoder: jsonDecoder, configuration: configuration) } - open static var current: ApplicationProtocol! { + public static var current: ApplicationProtocol! { return NSApplication.shared as? ApplicationProtocol } - open static let unknownCommandMessagePrefix = "Unknown Command Arguments" + public static let unknownCommandMessagePrefix = "Unknown Command Arguments" public static func unknownCommandMessage(fromArguments arguments: [String]) -> String { return "\(unknownCommandMessagePrefix): \(arguments.joined(separator: " "))" } - open static let helpText: String! = { + public static let helpText: String! = { guard let url = Application.bundle.url(forResource: "help", withExtension: "txt") else { return nil } @@ -66,13 +66,13 @@ open class Application: NSApplication, ApplicationProtocol { open private(set) var configuration: SpeculidConfigurationProtocol! open private(set) var builder: SpeculidBuilderProtocol! - open let statusItemProvider: StatusItemProviderProtocol - open let remoteObjectInterfaceProvider: RemoteObjectInterfaceProviderProtocol - open let installerObjectInterfaceProvider: InstallerObjectInterfaceProviderProtocol - open let regularExpressionBuilder: RegularExpressionSetBuilderProtocol - open let configurationBuilder: SpeculidConfigurationBuilderProtocol - open let jsonDecoder: JSONDecoder - open let imageSpecificationBuilder: SpeculidImageSpecificationBuilderProtocol + public let statusItemProvider: StatusItemProviderProtocol + public let remoteObjectInterfaceProvider: RemoteObjectInterfaceProviderProtocol + public let installerObjectInterfaceProvider: InstallerObjectInterfaceProviderProtocol + public let regularExpressionBuilder: RegularExpressionSetBuilderProtocol + public let configurationBuilder: SpeculidConfigurationBuilderProtocol + public let jsonDecoder: JSONDecoder + public let imageSpecificationBuilder: SpeculidImageSpecificationBuilderProtocol open var commandLineRunner: CommandLineRunnerProtocol public override init() { @@ -154,7 +154,7 @@ open class Application: NSApplication, ApplicationProtocol { .size: ("(\\d+\\.?\\d*)x(\\d+\\.?\\d*)", options: []), .number: ("\\d", options: []) ]) - } catch let error { + } catch { assertionFailure("Failed to parse regular expression: \(error)") } @@ -181,6 +181,10 @@ open class Application: NSApplication, ApplicationProtocol { terminate(sender) } + public static var author: String { + bundle.bundleIdentifier!.components(separatedBy: "-").first! + } + public static let bundle = Bundle(for: Application.self) public static let vcs = VersionControlInfo(jsonResource: "autorevision", fromBundle: Application.bundle) diff --git a/frameworks/speculid/Controllers/CommandLineInstaller.swift b/frameworks/speculid/Controllers/CommandLineInstaller.swift index f230a804..91bc14ff 100644 --- a/frameworks/speculid/Controllers/CommandLineInstaller.swift +++ b/frameworks/speculid/Controllers/CommandLineInstaller.swift @@ -35,12 +35,12 @@ public struct CommandLineInstaller { switch result { case let .success(installer): - installer.installCommandLineTool(fromBundleURL: Bundle.main.bundleURL, { error in + installer.installCommandLineTool(fromBundleURL: Bundle.main.bundleURL) { error in debugPrint(error) var cfError: Unmanaged? SMJobRemove(kSMDomainSystemLaunchd, "com.brightdigit.Speculid-Mac-Installer" as CFString, authorizationRef, true, &cfError) completed(error) - }) + } case let .error(error): debugPrint(error) completed(nil) diff --git a/frameworks/speculid/Controllers/CommandLineRunner.swift b/frameworks/speculid/Controllers/CommandLineRunner.swift index 15d15542..2614d340 100644 --- a/frameworks/speculid/Controllers/CommandLineRunner.swift +++ b/frameworks/speculid/Controllers/CommandLineRunner.swift @@ -44,7 +44,7 @@ public class CommandLineRunner: CommandLineRunnerProtocol { self.outputStream.write(" DEBUG") #endif return completed() - case let .process(url): + case let .process(url, update): let tryDocument: SpeculidDocumentProtocol? do { tryDocument = try Application.current.document(url: url) diff --git a/frameworks/speculid/Controllers/Service.swift b/frameworks/speculid/Controllers/Service.swift index 0b37a2d8..1223bb1e 100644 --- a/frameworks/speculid/Controllers/Service.swift +++ b/frameworks/speculid/Controllers/Service.swift @@ -2,6 +2,20 @@ import CairoSVG import Cocoa public final class Service: NSObject, ServiceProtocol { + public func updateAssetCatalogAtURL(_ url: URL, withItems items: [AssetCatalogItem], _ callback: @escaping ((NSError?) -> Void)) { + let document = AssetSpecificationDocument(fromItems: items) + let encoder = JSONEncoder() + encoder.outputFormatting = .prettyPrinted + do { + let data = try encoder.encode(document) + try data.write(to: url) + } catch { + callback(error as NSError) + return + } + callback(nil) + } + public func exportImageAtURL(_ url: URL, toSpecifications specifications: [ImageSpecification], _ callback: @escaping ((NSError?) -> Void)) { let imageFile = ImageFile(url: url, format: .svg) let builtImageHandle: ImageHandle? diff --git a/frameworks/speculid/Controllers/SpeculidApplicationModeParser.swift b/frameworks/speculid/Controllers/SpeculidApplicationModeParser.swift index 2ed8ec66..6317b10a 100644 --- a/frameworks/speculid/Controllers/SpeculidApplicationModeParser.swift +++ b/frameworks/speculid/Controllers/SpeculidApplicationModeParser.swift @@ -6,7 +6,7 @@ public struct SpeculidApplicationModeParser: SpeculidApplicationModeParserProtoc if commandLine.arguments.first == Bundle.main.executablePath { indicies.append(commandLine.arguments.startIndex) } - if let index = commandLine.arguments.index(of: "-NSDocumentRevisionsDebugMode") { + if let index = commandLine.arguments.firstIndex(of: "-NSDocumentRevisionsDebugMode") { indicies.append(index) indicies.append(index.advanced(by: 1)) } @@ -23,7 +23,7 @@ public struct SpeculidApplicationModeParser: SpeculidApplicationModeParserProtoc } else if let index = arguments.firstIndex(of: "--process") { let filePath = arguments[arguments.index(after: index)] if FileManager.default.fileExists(atPath: filePath) { - return .command(.process(URL(fileURLWithPath: filePath))) + return .command(.process(URL(fileURLWithPath: filePath), true)) } else { return .command(.unknown(arguments)) } @@ -39,10 +39,10 @@ public struct SpeculidApplicationModeParser: SpeculidApplicationModeParserProtoc } } } - -@available(swift, obsoleted: 4.2) -extension Array where Element: Equatable { - func firstIndex(of element: Element) -> Index? { - return index(of: element) - } -} +// +// @available(swift, obsoleted: 4.2) +// extension Array where Element: Equatable { +// func firstIndex(of element: Element) -> Index? { +// return firstIndex(of: element) +// } +// } diff --git a/frameworks/speculid/Controllers/SpeculidBuilder.swift b/frameworks/speculid/Controllers/SpeculidBuilder.swift index 8119f5c1..b7003722 100644 --- a/frameworks/speculid/Controllers/SpeculidBuilder.swift +++ b/frameworks/speculid/Controllers/SpeculidBuilder.swift @@ -5,10 +5,10 @@ public typealias ImageConversionPair = (image: AssetSpecificationProtocol, conve public typealias ImageConversionDictionary = [String: ImageConversionPair] public extension SpeculidDocumentProtocol { - public var sourceImageURL: URL { + var sourceImageURL: URL { return url.deletingLastPathComponent().appendingPathComponent(specificationsFile.sourceImageRelativePath) } - public func destinationName(forImage image: AssetSpecificationProtocol) -> String { + func destinationName(forImage image: AssetSpecificationProtocol) -> String { if let filename = image.filename { return filename } else if let scale = image.scale { @@ -23,9 +23,15 @@ public extension SpeculidDocumentProtocol { } } - public func destinationURL(forImage image: AssetSpecificationProtocol) -> URL { + @available(*, unavailable) + func destinationURL(forImage image: AssetSpecificationProtocol) -> URL { return url.deletingLastPathComponent().appendingPathComponent(specificationsFile.assetDirectoryRelativePath, isDirectory: true).appendingPathComponent(destinationName(forImage: image)) } + + func destinationURL(forFileName fileName: String) -> URL { + return url.deletingLastPathComponent().appendingPathComponent(specificationsFile.assetDirectoryRelativePath, isDirectory: true).appendingPathComponent(fileName) + } + // destinationFileNames } public struct SpeculidBuilder: SpeculidBuilderProtocol { @@ -35,14 +41,38 @@ public struct SpeculidBuilder: SpeculidBuilderProtocol { public func build(document: SpeculidDocumentProtocol, callback: @escaping ((Error?) -> Void)) { let imageSpecifications: [ImageSpecification] + + let destinationFileNames = document.assetFile.document.images.map { + asset in + (asset, document.destinationName(forImage: asset)) + } do { - imageSpecifications = try document.asset.images.map { (asset) -> ImageSpecification in - return try self.imageSpecificationBuilder.imageSpecification(forURL: document.destinationURL(forImage: asset), withSpecifications: document.specificationsFile, andAsset: asset) + imageSpecifications = try destinationFileNames.map { (asset, fileName) -> ImageSpecification in + try self.imageSpecificationBuilder.imageSpecification(forURL: document.destinationURL(forFileName: fileName), withSpecifications: document.specificationsFile, andAsset: asset) } - } catch let error { + } catch { return callback(error) } - Application.current.service.exportImageAtURL(document.sourceImageURL, toSpecifications: imageSpecifications, callback) + Application.current.service.exportImageAtURL(document.sourceImageURL, toSpecifications: imageSpecifications) { + error in + if let error = error { + callback(error) + return + } + let mode = self.configuration.mode + guard case let .command(args) = mode else { + callback(error) + return + } + guard case let .process(_, true) = args else { + callback(error) + return + } + let items = destinationFileNames.map( + AssetCatalogItem.init + ) + Application.current.service.updateAssetCatalogAtURL(document.assetFile.url, withItems: items, callback) + } } } diff --git a/frameworks/speculid/Controllers/VersionMenuItem.swift b/frameworks/speculid/Controllers/VersionMenuItem.swift index 7bf3e7c8..ab5d71c9 100644 --- a/frameworks/speculid/Controllers/VersionMenuItem.swift +++ b/frameworks/speculid/Controllers/VersionMenuItem.swift @@ -11,7 +11,7 @@ public class VersionMenuItem: NSMenuItem { public static func buildNumbers(fromResource resource: String?, withExtension extension: String?) -> Set? { if let url = Application.bundle.url(forResource: resource, withExtension: `extension`) { if let text = try? String(contentsOf: url) { - return Set(text.components(separatedBy: CharacterSet.newlines).flatMap { Int($0) }) + return Set(text.components(separatedBy: CharacterSet.newlines).compactMap { Int($0) }) } } return nil diff --git a/frameworks/speculid/Extensions/NSColor.swift b/frameworks/speculid/Extensions/NSColor.swift index d7d48386..f32f56fd 100644 --- a/frameworks/speculid/Extensions/NSColor.swift +++ b/frameworks/speculid/Extensions/NSColor.swift @@ -88,7 +88,7 @@ extension NSColor { throw UIColorInputError.unableToScanHexValue } - switch hexString.characters.count { + switch hexString.count { case 3: self.init(hex3: UInt16(hexValue)) case 4: @@ -162,15 +162,15 @@ extension String { let index = self.index(startIndex, offsetBy: 1) let hexString = self[index...] - switch hexString.characters.count { + switch hexString.count { case 4: return "#" - + hexString.substring(from: characters.index(startIndex, offsetBy: 1)) - + hexString.substring(to: characters.index(startIndex, offsetBy: 1)) + + hexString.substring(from: self.index(startIndex, offsetBy: 1)) + + hexString.substring(to: self.index(startIndex, offsetBy: 1)) case 8: return "#" - + hexString.substring(from: characters.index(startIndex, offsetBy: 2)) - + hexString.substring(to: characters.index(startIndex, offsetBy: 2)) + + hexString.substring(from: self.index(startIndex, offsetBy: 2)) + + hexString.substring(to: self.index(startIndex, offsetBy: 2)) default: return nil } diff --git a/frameworks/speculid/Extensions/NSNumber.swift b/frameworks/speculid/Extensions/NSNumber.swift new file mode 100644 index 00000000..af2e7c6d --- /dev/null +++ b/frameworks/speculid/Extensions/NSNumber.swift @@ -0,0 +1,25 @@ +import Foundation + +extension NSNumber { + // CGFloat -> NSNumber + private convenience init(doubleOrFloat: Double) { + self.init(value: doubleOrFloat) + } + private convenience init(doubleOrFloat: Float) { + self.init(value: doubleOrFloat) + } + convenience init(cgFloat: CGFloat) { + self.init(doubleOrFloat: cgFloat.native) + } + + // NSNumber -> CGFloat + private func doubleOrFloatValue() -> Double { + return doubleValue + } + private func doubleOrFloatValue() -> Float { + return floatValue + } + var cgFloatValue: CGFloat { + return CGFloat(floatLiteral: doubleOrFloatValue()) + } +} diff --git a/frameworks/speculid/Extensions/String.swift b/frameworks/speculid/Extensions/String.swift index bc1e8d1b..648a5af6 100644 --- a/frameworks/speculid/Extensions/String.swift +++ b/frameworks/speculid/Extensions/String.swift @@ -2,12 +2,12 @@ import Foundation extension String { public func firstMatchGroups(regex: NSRegularExpression) -> [String]? { - let range = NSRange(0 ..< characters.count) + let range = NSRange(0 ..< count) guard let result = regex.firstMatch(in: self, options: [], range: range) else { return nil } - return (0 ..< result.numberOfRanges).flatMap { (index) -> String? in + return (0 ..< result.numberOfRanges).compactMap { (index) -> String? in guard let range = Range(result.range(at: index), in: self) else { return nil } diff --git a/frameworks/speculid/Extensions/Version.swift b/frameworks/speculid/Extensions/Version.swift index b64df234..d6dcb5b8 100644 --- a/frameworks/speculid/Extensions/Version.swift +++ b/frameworks/speculid/Extensions/Version.swift @@ -2,7 +2,7 @@ import Foundation import SwiftVer public extension Version { - public var developmentDescription: String { + var developmentDescription: String { let buildnumbers = VersionMenuItem.buildNumbers(fromResource: "build", withExtension: "list") let title: String if buildnumbers?.contains(build) == true { diff --git a/frameworks/speculid/Models/AssetCatalogItem.swift b/frameworks/speculid/Models/AssetCatalogItem.swift new file mode 100644 index 00000000..97dcd067 --- /dev/null +++ b/frameworks/speculid/Models/AssetCatalogItem.swift @@ -0,0 +1,53 @@ +// +// AssetCatalogDocument.swift +// Speculid-Mac-App +// +// Created by Leo Dion on 9/25/19. +// Copyright © 2019 Bright Digit, LLC. All rights reserved. +// +import Foundation + +@objc open class AssetCatalogItem: NSObject, NSSecureCoding { + public static let supportsSecureCoding: Bool = true + + public func encode(with aCoder: NSCoder) { + aCoder.encode(filename, forKey: "filename") + aCoder.encode(scale, forKey: "scale") + aCoder.encode(size, forKey: "size") + aCoder.encode(idiom, forKey: "idiom") + aCoder.encode(subtype, forKey: "subtype") + aCoder.encode(role, forKey: "role") + } + + // swiftlint:disable identifier_name + public required init?(coder aDecoder: NSCoder) { + guard let filename = aDecoder.decodeObject(forKey: "filename") as? String else { + return nil + } + guard let idiom = aDecoder.decodeObject(forKey: "idiom") as? String else { + return nil + } + size = aDecoder.decodeObject(forKey: "size").flatMap { $0 as? AssetCatalogItemSize } + scale = aDecoder.decodeObject(forKey: "scale").flatMap { $0 as? NSNumber } + subtype = aDecoder.decodeObject(forKey: "subtype").flatMap { $0 as? String } + role = aDecoder.decodeObject(forKey: "role").flatMap { $0 as? String } + self.filename = filename + self.idiom = idiom + } + + public let idiom: String + public let scale: NSNumber? + public let size: AssetCatalogItemSize? + public let filename: String + public let subtype: String? + public let role: String? + + init(specs: AssetSpecificationProtocol, filename: String) { + idiom = specs.idiom.rawValue + subtype = specs.subtype?.rawValue + role = specs.role?.rawValue + scale = specs.scale.map(NSNumber.init) + size = specs.size.map(AssetCatalogItemSize.init) + self.filename = filename + } +} diff --git a/frameworks/speculid/Models/AssetCatalogItemSize.swift b/frameworks/speculid/Models/AssetCatalogItemSize.swift new file mode 100644 index 00000000..c40996cc --- /dev/null +++ b/frameworks/speculid/Models/AssetCatalogItemSize.swift @@ -0,0 +1,37 @@ +import Foundation + +@objc open class AssetCatalogItemSize: NSObject, NSSecureCoding { + public static let supportsSecureCoding: Bool = true + + public func encode(with coder: NSCoder) { + coder.encode(width, forKey: "width") + coder.encode(height, forKey: "height") + } + + public required init?(coder: NSCoder) { + guard let width = coder.decodeObject(forKey: "width") as? NSNumber else { + return nil + } + + guard let height = coder.decodeObject(forKey: "height") as? NSNumber else { + return nil + } + + self.width = width + self.height = height + } + + public let width: NSNumber + public let height: NSNumber + + public init(size: CGSize) { + width = size.width as NSNumber + height = size.height as NSNumber + } +} + +extension AssetCatalogItemSize { + var cgSize: CGSize { + return CGSize(width: width.cgFloatValue, height: height.cgFloatValue) + } +} diff --git a/frameworks/speculid/Models/AssetSpecification.swift b/frameworks/speculid/Models/AssetSpecification.swift index 9c6db396..24a26d63 100644 --- a/frameworks/speculid/Models/AssetSpecification.swift +++ b/frameworks/speculid/Models/AssetSpecification.swift @@ -1,22 +1,42 @@ import Foundation +public enum AppleWatchRole: String, Codable { + case notificationCenter, companionSettings, appLauncher, longLook, quickLook +} + +public enum AppleWatchType: String, Codable { + case size38 = "38mm", size40 = "40mm", size42 = "42mm", size44 = "44mm" +} + +extension CGFloat { + var clean: String { + return truncatingRemainder(dividingBy: 1) == 0 ? String(format: "%.0f", self) : description + } +} + public struct AssetSpecification: AssetSpecificationProtocol, Codable { public let idiom: ImageIdiom public let scale: CGFloat? public let size: CGSize? public let filename: String? + public let role: AppleWatchRole? + public let subtype: AppleWatchType? enum CodingKeys: String, CodingKey { case idiom case scale case size case filename + case role + case subtype } - public init(idiom: ImageIdiom, scale: CGFloat? = nil, size: CGSize? = nil, filename: String? = nil) { + public init(idiom: ImageIdiom, scale: CGFloat? = nil, size: CGSize? = nil, role: AppleWatchRole? = nil, subtype: AppleWatchType? = nil, filename: String? = nil) { self.idiom = idiom self.scale = scale self.size = size self.filename = filename + self.role = role + self.subtype = subtype } public init(specifications: AssetSpecificationProtocol) { @@ -24,6 +44,8 @@ public struct AssetSpecification: AssetSpecificationProtocol, Codable { scale = specifications.scale size = specifications.size filename = specifications.filename + subtype = specifications.subtype + role = specifications.role } public init(from decoder: Decoder) throws { @@ -52,26 +74,53 @@ public struct AssetSpecification: AssetSpecificationProtocol, Codable { size = nil } - // - // - // if let scaleString = dictionary["scale"]?.firstMatchGroups(regex: scaleRegex)?[1], let value = Double(scaleString) { - // scale = CGFloat(value) - // } else { - // scale = nil - // } - // - // guard let idiomString = dictionary["idiom"], let idiom = ImageIdiom(rawValue: idiomString) else { - // return nil - // } - // - // - // - // if let dimensionStrings = dictionary["size"]?.firstMatchGroups(regex: sizeRegex), let width = Double(dimensionStrings[1]), let height = Double(dimensionStrings[2]) { - // size = CGSize(width: width, height: height) - // } else { - // size = nil - // } + role = try container.decodeIfPresent(AppleWatchRole.self, forKey: .role) + subtype = try container.decodeIfPresent(AppleWatchType.self, forKey: .subtype) + } + + func formatSize(_ size: CGSize) -> String { + return "\(size.width.clean)x\(size.height.clean)" + } + + func formatScale(_ scale: CGFloat) -> String { + let scale = Int(scale.rounded()) + return "\(scale)x" + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if let size = size { + try container.encode(formatSize(size), forKey: .size) + } + + if let scale = scale { + try container.encode(formatScale(scale), forKey: .scale) + } + + if let filename = filename { + try container.encode(filename, forKey: .filename) + } + + if let subtype = subtype { + try container.encode(subtype, forKey: .subtype) + } + + if let role = role { + try container.encode(role, forKey: .role) + } + + try container.encode(idiom, forKey: .idiom) } - public func encode(to _: Encoder) throws {} + public init?(_ item: AssetCatalogItem) { + guard let idiom = ImageIdiom(rawValue: item.idiom) else { + return nil + } + self.idiom = idiom + filename = item.filename + scale = item.scale?.cgFloatValue + size = item.size?.cgSize + role = item.role.flatMap { AppleWatchRole(rawValue: $0) } + subtype = item.subtype.flatMap { AppleWatchType(rawValue: $0) } + } } diff --git a/frameworks/speculid/Models/AssetSpecificationDocument.swift b/frameworks/speculid/Models/AssetSpecificationDocument.swift index 7540b0f8..a034f5e5 100644 --- a/frameworks/speculid/Models/AssetSpecificationDocument.swift +++ b/frameworks/speculid/Models/AssetSpecificationDocument.swift @@ -1,20 +1,31 @@ import Foundation public struct AssetSpecificationDocument: AssetSpecificationDocumentProtocol, Codable { + public let info: AssetSpecificationMetadataProtocol public let images: [AssetSpecificationProtocol] public enum CodingKeys: String, CodingKey { case images + case info } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) + let info = try container.decode(AssetSpecificationMetadata.self, forKey: .info) let images = try container.decode([AssetSpecification].self, forKey: CodingKeys.images) self.images = images + self.info = info } public func encode(to encoder: Encoder) throws { var container = try encoder.container(keyedBy: CodingKeys.self) + try container.encode(images.map(AssetSpecification.init(specifications:)), forKey: .images) + try container.encode(AssetSpecificationMetadata(info), forKey: .info) + } + + public init(fromItems items: [AssetCatalogItem]) { + images = items.compactMap(AssetSpecification.init) + info = AssetSpecificationMetadata() } } diff --git a/frameworks/speculid/Models/AssetSpecificationFile.swift b/frameworks/speculid/Models/AssetSpecificationFile.swift new file mode 100644 index 00000000..0d71fec2 --- /dev/null +++ b/frameworks/speculid/Models/AssetSpecificationFile.swift @@ -0,0 +1,6 @@ +import Foundation + +public struct AssetSpecificationFile: AssetSpecificationFileProtocol { + public let url: URL + public let document: AssetSpecificationDocumentProtocol +} diff --git a/frameworks/speculid/Models/AssetSpecificationFileProtocol.swift b/frameworks/speculid/Models/AssetSpecificationFileProtocol.swift new file mode 100644 index 00000000..fef6ba5f --- /dev/null +++ b/frameworks/speculid/Models/AssetSpecificationFileProtocol.swift @@ -0,0 +1,6 @@ +import Foundation + +public protocol AssetSpecificationFileProtocol { + var url: URL { get } + var document: AssetSpecificationDocumentProtocol { get } +} diff --git a/frameworks/speculid/Models/AssetSpecificationMetadata.swift b/frameworks/speculid/Models/AssetSpecificationMetadata.swift new file mode 100644 index 00000000..09edb6ac --- /dev/null +++ b/frameworks/speculid/Models/AssetSpecificationMetadata.swift @@ -0,0 +1,19 @@ +import Foundation + +public struct AssetSpecificationMetadata: AssetSpecificationMetadataProtocol { + public static let defaultAuthor = Application.author + public let author: String // = Application.bundle.bundleIdentifier! + public let version: Int // = 1 + + init(author: String = AssetSpecificationMetadata.defaultAuthor, version: Int = 1) { + self.author = author + self.version = version + } +} + +extension AssetSpecificationMetadata { + init(_ metadata: AssetSpecificationMetadataProtocol) { + author = metadata.author + version = metadata.version + } +} diff --git a/frameworks/speculid/Models/CwlSysctl.swift b/frameworks/speculid/Models/CwlSysctl.swift index 1de4c5ca..916482a8 100644 --- a/frameworks/speculid/Models/CwlSysctl.swift +++ b/frameworks/speculid/Models/CwlSysctl.swift @@ -26,9 +26,9 @@ public struct Sysctl { } // Run the actual request with an appropriately sized array buffer - let data = Array(repeating: 0, count: requiredSize) + let data = [Int8](repeating: 0, count: requiredSize) let result = data.withUnsafeBufferPointer { dataBuffer -> Int32 in - return Darwin.sysctl(UnsafeMutablePointer(mutating: keysPointer.baseAddress), UInt32(keys.count), UnsafeMutableRawPointer(mutating: dataBuffer.baseAddress), &requiredSize, nil, 0) + Darwin.sysctl(UnsafeMutablePointer(mutating: keysPointer.baseAddress), UInt32(keys.count), UnsafeMutableRawPointer(mutating: dataBuffer.baseAddress), &requiredSize, nil, 0) } if result != 0 { throw POSIXErrorCode(rawValue: errno).map { Error.posixError($0) } ?? Error.unknown @@ -41,7 +41,7 @@ public struct Sysctl { /// Convert a sysctl name string like "hw.memsize" to the array of `sysctl` identifiers (e.g. [CTL_HW, HW_MEMSIZE]) public static func keysForName(_ name: String) throws -> [Int32] { var keysBufferSize = Int(CTL_MAXNAME) - var keysBuffer = Array(repeating: 0, count: keysBufferSize) + var keysBuffer = [Int32](repeating: 0, count: keysBufferSize) try keysBuffer.withUnsafeMutableBufferPointer { (lbp: inout UnsafeMutableBufferPointer) throws in try name.withCString { (nbp: UnsafePointer) throws in guard sysctlnametomib(nbp, lbp.baseAddress, &keysBufferSize) == 0 else { diff --git a/frameworks/speculid/Models/SpeculidCommandArgumentSet.swift b/frameworks/speculid/Models/SpeculidCommandArgumentSet.swift index d797c1a0..e14ba509 100644 --- a/frameworks/speculid/Models/SpeculidCommandArgumentSet.swift +++ b/frameworks/speculid/Models/SpeculidCommandArgumentSet.swift @@ -14,7 +14,7 @@ public enum SpeculidCommandArgumentSet: Equatable { case help case unknown([String]) case version - case process(URL) + case process(URL, Bool) case install(InstallType) case debugLocation } diff --git a/frameworks/speculid/Models/SpeculidDocument.swift b/frameworks/speculid/Models/SpeculidDocument.swift index 5659d1d5..23c8a787 100644 --- a/frameworks/speculid/Models/SpeculidDocument.swift +++ b/frameworks/speculid/Models/SpeculidDocument.swift @@ -3,7 +3,8 @@ import Foundation public struct SpeculidDocument: SpeculidDocumentProtocol { public let url: URL public let specificationsFile: SpeculidSpecificationsFileProtocol - public let asset: AssetSpecificationDocumentProtocol + // public let asset: AssetSpecificationDocumentProtocol + public let assetFile: AssetSpecificationFileProtocol public init(url: URL, decoder: JSONDecoder, configuration _: SpeculidConfigurationProtocol? = nil) throws { let specificationsFileData = try Data(contentsOf: url) @@ -15,54 +16,7 @@ public struct SpeculidDocument: SpeculidDocumentProtocol { let asset = try decoder.decode(AssetSpecificationDocument.self, from: assetData) self.specificationsFile = specificationsFile - self.asset = asset + assetFile = AssetSpecificationFile(url: contentsJSONURL, document: asset) self.url = url - // - // guard let specifications = SpeculidSpecifications(url: url) else { - // return nil - // } - // - // guard let contentsJSONData = try? Data(contentsOf: specifications.contentsDirectoryURL.appendingPathComponent("Contents.json")) else { - // return nil - // } - // - // guard let contentsJSON = try? JSONSerialization.jsonObject(with: contentsJSONData, options: []) as? [String: Any] else { - // return nil - // } - // - // guard let images = contentsJSON?["images"] as? [[String: String]] else { - // return nil - // } - // - // self.images = images.flatMap { (dictionary) -> AssetSpecification? in - // let scale: CGFloat? - // let size: CGSize? - // - // let scaleRegex: NSRegularExpression = Application.current.regularExpressions.regularExpression(for: .scale) - // - // if let scaleString = dictionary["scale"]?.firstMatchGroups(regex: scaleRegex)?[1], let value = Double(scaleString) { - // scale = CGFloat(value) - // } else { - // scale = nil - // } - // - // guard let idiomString = dictionary["idiom"], let idiom = ImageIdiom(rawValue: idiomString) else { - // return nil - // } - // - // let sizeRegex: NSRegularExpression = Application.current.regularExpressions.regularExpression(for: .size) - // - // if let dimensionStrings = dictionary["size"]?.firstMatchGroups(regex: sizeRegex), let width = Double(dimensionStrings[1]), let height = Double(dimensionStrings[2]) { - // size = CGSize(width: width, height: height) - // } else { - // size = nil - // } - // - // let filename = dictionary["filename"] - // - // return AssetSpecification(idiom: idiom, scale: scale, size: size, filename: filename) - // } - // - // self.specifications = specifications } } diff --git a/frameworks/speculid/Protocols/AnalyticsConfigurationProtocol.swift b/frameworks/speculid/Protocols/AnalyticsConfigurationProtocol.swift index a3e75c7d..eb3912c3 100644 --- a/frameworks/speculid/Protocols/AnalyticsConfigurationProtocol.swift +++ b/frameworks/speculid/Protocols/AnalyticsConfigurationProtocol.swift @@ -11,7 +11,7 @@ public protocol AnalyticsConfigurationProtocol { } public extension AnalyticsConfigurationProtocol { - public var parameters: AnalyticsParameterDictionary { + var parameters: AnalyticsParameterDictionary { var dictionary = customParameters let mainParameters: AnalyticsParameterDictionary = [ diff --git a/frameworks/speculid/Protocols/AssetSpecificationDocumentProtocol.swift b/frameworks/speculid/Protocols/AssetSpecificationDocumentProtocol.swift index 7438236a..6f18537c 100644 --- a/frameworks/speculid/Protocols/AssetSpecificationDocumentProtocol.swift +++ b/frameworks/speculid/Protocols/AssetSpecificationDocumentProtocol.swift @@ -1,5 +1,6 @@ import Foundation public protocol AssetSpecificationDocumentProtocol: Codable { + var info: AssetSpecificationMetadataProtocol { get } var images: [AssetSpecificationProtocol] { get } } diff --git a/frameworks/speculid/Protocols/AssetSpecificationMetadataProtocol.swift b/frameworks/speculid/Protocols/AssetSpecificationMetadataProtocol.swift new file mode 100644 index 00000000..bca2c98a --- /dev/null +++ b/frameworks/speculid/Protocols/AssetSpecificationMetadataProtocol.swift @@ -0,0 +1,6 @@ +import Foundation + +public protocol AssetSpecificationMetadataProtocol: Codable { + var author: String { get } + var version: Int { get } +} diff --git a/frameworks/speculid/Protocols/AssetSpecificationProtocol.swift b/frameworks/speculid/Protocols/AssetSpecificationProtocol.swift index de1f7556..e3a283a2 100644 --- a/frameworks/speculid/Protocols/AssetSpecificationProtocol.swift +++ b/frameworks/speculid/Protocols/AssetSpecificationProtocol.swift @@ -12,4 +12,6 @@ public protocol AssetSpecificationProtocol { var scale: CGFloat? { get } var size: CGSize? { get } var filename: String? { get } + var role: AppleWatchRole? { get } + var subtype: AppleWatchType? { get } } diff --git a/frameworks/speculid/Protocols/ServiceProtocol.swift b/frameworks/speculid/Protocols/ServiceProtocol.swift index d1e5e1bd..a2061b83 100644 --- a/frameworks/speculid/Protocols/ServiceProtocol.swift +++ b/frameworks/speculid/Protocols/ServiceProtocol.swift @@ -3,4 +3,5 @@ import Foundation @objc public protocol ServiceProtocol { func exportImageAtURL(_ url: URL, toSpecifications specifications: [ImageSpecification], _ callback: @escaping ((NSError?) -> Void)) + func updateAssetCatalogAtURL(_ url: URL, withItems items: [AssetCatalogItem], _ callback: @escaping ((NSError?) -> Void)) } diff --git a/frameworks/speculid/Protocols/SpeculidDocumentProtocol.swift b/frameworks/speculid/Protocols/SpeculidDocumentProtocol.swift index b55a1750..495390d9 100644 --- a/frameworks/speculid/Protocols/SpeculidDocumentProtocol.swift +++ b/frameworks/speculid/Protocols/SpeculidDocumentProtocol.swift @@ -3,5 +3,6 @@ import Foundation public protocol SpeculidDocumentProtocol { var url: URL { get } var specificationsFile: SpeculidSpecificationsFileProtocol { get } - var asset: AssetSpecificationDocumentProtocol { get } + // var asset: AssetSpecificationDocumentProtocol { get } + var assetFile: AssetSpecificationFileProtocol { get } } diff --git a/scripts/CodeSignUpdate.sh b/scripts/CodeSignUpdate.sh index 1856d6f6..3df29b4a 100755 --- a/scripts/CodeSignUpdate.sh +++ b/scripts/CodeSignUpdate.sh @@ -6,7 +6,7 @@ # Created by Erik Berglund. # Copyright © 2018 Erik Berglund. All rights reserved. -set -e +#set -e ### ### CUSTOM VARIABLES diff --git a/tests/speculid/Controllers/SpeculidApplicationModeParserTest.swift b/tests/speculid/Controllers/SpeculidApplicationModeParserTest.swift index bc549f3a..1d79d5c1 100644 --- a/tests/speculid/Controllers/SpeculidApplicationModeParserTest.swift +++ b/tests/speculid/Controllers/SpeculidApplicationModeParserTest.swift @@ -15,29 +15,29 @@ extension Array where Element == String { return (0 ..< count).map { _ in String.randomAlphanumeric(ofLength: 100) } } } - -@available(swift, obsoleted: 4.2) -extension Array { - func randomElement() -> Element? { - guard count > 0 else { - return nil - } - let index = Index(arc4random_uniform(UInt32(count))) - return self[index] - } -} - -@available(swift, obsoleted: 4.2) -extension String { - func randomElement() -> Character? { - guard count > 0 else { - return nil - } - let offset = Int(arc4random_uniform(UInt32(count))) - let index = self.index(startIndex, offsetBy: offset) - return self[index] - } -} +// +// @available(swift, obsoleted: 4.2) +// extension Array { +// func randomElement() -> Element? { +// guard count > 0 else { +// return nil +// } +// let index = Index(arc4random_uniform(UInt32(count))) +// return self[index] +// } +// } +// +// @available(swift, obsoleted: 4.2) +// extension String { +// func randomElement() -> Character? { +// guard count > 0 else { +// return nil +// } +// let offset = Int(arc4random_uniform(UInt32(count))) +// let index = self.index(startIndex, offsetBy: offset) +// return self[index] +// } +// } struct SimpleCommandLineArgumentProvider: CommandLineArgumentProviderProtocol { public let arguments: [String]