From d0ba31bf2963f95a643b99145fcfcff6c573bda3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Sch=C3=B6nig?= Date: Fri, 24 Nov 2023 15:27:24 +1100 Subject: [PATCH] Docs fix (#318) * Clean-up TripKitUI and InterApp as they no longer support Objective-C * Latest setup-python * Trying to get jazzy * Docs need latest Xcode, too * Unify #if os calls * Tie to modules rather than OS * Slight tweaks to docs --- .github/workflows/docs-dryrun.yml | 6 +++++- .github/workflows/docs.yml | 6 +++++- Gemfile.lock | 20 ++++++++----------- Scripts/docs/tripkit.jazzy.yaml | 3 +-- Scripts/docs/tripkitui.jazzy.yaml | 3 +-- .../TripKit/UIKit/TKStyleManager+UIKit.swift | 2 +- Sources/TripKit/UIKit/UIColor+TripKit.swift | 2 +- .../UIKit/UIColor+TripKitDefault.swift | 2 +- Sources/TripKit/core/Loc+TripKit.swift | 4 ++-- Sources/TripKit/core/TKCrossPlatform.swift | 4 ++-- Sources/TripKit/core/TKImage+TripKit.swift | 6 +++--- Sources/TripKit/helpers/TKImageBuilder.swift | 2 +- .../TKCalendarManager+Autocompleting.swift | 4 ++-- .../TKContactsManager+TKAutocompleting.swift | 4 ++-- .../TripKit/managers/TKContactsManager.swift | 14 ++++++------- ...PermissionManager+AuthorizationAlert.swift | 2 +- Sources/TripKit/managers/TKStyleManager.swift | 20 ++++++++++--------- Sources/TripKit/model/API/BaseAPIModels.swift | 6 +++--- .../model/CoreData/Shape+CoreDataClass.swift | 4 ++-- .../TripKit/model/CoreData/Shape+Data.swift | 6 +++--- .../TripKit/model/CoreData/StopLocation.swift | 2 +- .../CoreData/StopVisits+CoreDataClass.swift | 4 ++-- .../model/CoreData/Trip+CoreDataClass.swift | 6 +++--- .../CoreData/TripGroup+CoreDataClass.swift | 2 +- Sources/TripKit/model/TKSegment.swift | 2 +- Sources/TripKit/search/TKGeocoding.swift | 8 ++++---- .../TripKit/search/TKModeImageBuilder.swift | 6 +++--- .../TripKit/server/TKServer+ModeImage.swift | 8 ++++---- .../TripKit/sharing/TKShareURLProvider.swift | 2 +- .../vendor/ASPolygonKit/QuickLookable.swift | 8 ++++---- .../Supporting Files/TripKitInterApp.h | 17 ---------------- .../TripKitUI/Supporting Files/TripKitUI.h | 17 ---------------- .../RxTripKit/NSManagedObjectContext+Rx.swift | 2 +- .../TKUIAnnotations+TripKit.swift | 6 +++--- TripKit.xcodeproj/project.pbxproj | 10 ---------- 35 files changed, 90 insertions(+), 130 deletions(-) delete mode 100644 Sources/TripKitInterApp/Supporting Files/TripKitInterApp.h delete mode 100644 Sources/TripKitUI/Supporting Files/TripKitUI.h diff --git a/.github/workflows/docs-dryrun.yml b/.github/workflows/docs-dryrun.yml index cce8aa8bb..c4c68d897 100644 --- a/.github/workflows/docs-dryrun.yml +++ b/.github/workflows/docs-dryrun.yml @@ -13,7 +13,10 @@ jobs: steps: - name: Checkout main uses: actions/checkout@v4 - - uses: actions/setup-python@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + - uses: actions/setup-python@v4 with: python-version: 3.x - name: Prepare dependencies @@ -24,6 +27,7 @@ jobs: pip install mkdocs pip install pymdown-extensions mkdocs --version + bundle install - name: Build docs run: | diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5d22409a2..bb7954bc3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,10 @@ jobs: steps: - name: Checkout main uses: actions/checkout@v4 - - uses: actions/setup-python@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + - uses: actions/setup-python@v4 with: python-version: 3.x - name: Prepare dependencies @@ -24,6 +27,7 @@ jobs: pip install mkdocs pip install pymdown-extensions mkdocs --version + bundle install - name: Build docs run: | diff --git a/Gemfile.lock b/Gemfile.lock index 3b3b522d8..ab3e06f5d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: CFPropertyList (3.0.6) rexml - activesupport (7.1.1) + activesupport (7.1.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -23,12 +23,12 @@ GEM base64 (0.2.0) bigdecimal (3.1.4) claide (1.0.3) - cocoapods (1.14.2) + cocoapods (1.14.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.14.2) + cocoapods-core (= 1.14.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 2.0) + cocoapods-downloader (>= 2.1, < 3.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-trunk (>= 1.6.0, < 2.0) @@ -41,7 +41,7 @@ GEM nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.23.0, < 2.0) - cocoapods-core (1.14.2) + cocoapods-core (1.14.3) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -52,7 +52,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (2.0) + cocoapods-downloader (2.1) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -71,8 +71,7 @@ GEM commander (>= 4.3.5) highline (>= 1.7.1) security - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) + domain_name (0.6.20231109) drb (2.2.0) ruby2_keywords escape (0.0.4) @@ -141,13 +140,10 @@ GEM plist (>= 3.1.0, < 4.0.0) sqlite3 (1.6.8) mini_portile2 (~> 2.8.0) - typhoeus (1.4.0) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) xcinvoke (0.3.0) liferaft (~> 0.0.6) xcode-install (2.0.9) diff --git a/Scripts/docs/tripkit.jazzy.yaml b/Scripts/docs/tripkit.jazzy.yaml index 24eead41e..2ed088e96 100644 --- a/Scripts/docs/tripkit.jazzy.yaml +++ b/Scripts/docs/tripkit.jazzy.yaml @@ -18,13 +18,12 @@ abstract: api/*.md custom_categories: - name: Setup & Configuration children: - - TKTripKit + - TripKit - TKConfig - TKRegion - TKRegionManager - TKServer - TKSettings - - TKUserProfileHelper - name: Trip Planning children: - TKRouter diff --git a/Scripts/docs/tripkitui.jazzy.yaml b/Scripts/docs/tripkitui.jazzy.yaml index db4baae34..965619bbc 100644 --- a/Scripts/docs/tripkitui.jazzy.yaml +++ b/Scripts/docs/tripkitui.jazzy.yaml @@ -10,8 +10,7 @@ podspec: ../../TripKitUI.podspec exclude: - /*/TripKitUI/helper/Categories/* - - /*/TripKitUI/vendor/Differentiator/* - - /*/TripKitUI/vendor/RxDataSources/* + - /*/TripKitUI/vendor/* custom_categories: - name: Trip Planning diff --git a/Sources/TripKit/UIKit/TKStyleManager+UIKit.swift b/Sources/TripKit/UIKit/TKStyleManager+UIKit.swift index e4cbdcd76..bb6a34e5b 100644 --- a/Sources/TripKit/UIKit/TKStyleManager+UIKit.swift +++ b/Sources/TripKit/UIKit/TKStyleManager+UIKit.swift @@ -6,7 +6,7 @@ // Copyright © 2021 SkedGo Pty Ltd. All rights reserved. // -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit diff --git a/Sources/TripKit/UIKit/UIColor+TripKit.swift b/Sources/TripKit/UIKit/UIColor+TripKit.swift index ce939b61c..ebfc8ebd7 100644 --- a/Sources/TripKit/UIKit/UIColor+TripKit.swift +++ b/Sources/TripKit/UIKit/UIColor+TripKit.swift @@ -6,7 +6,7 @@ // Copyright © 2019 SkedGo Pty Ltd. All rights reserved. // -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import Foundation import UIKit diff --git a/Sources/TripKit/UIKit/UIColor+TripKitDefault.swift b/Sources/TripKit/UIKit/UIColor+TripKitDefault.swift index b7565a512..6f0de83cc 100644 --- a/Sources/TripKit/UIKit/UIColor+TripKitDefault.swift +++ b/Sources/TripKit/UIKit/UIColor+TripKitDefault.swift @@ -6,7 +6,7 @@ // Copyright © 2019 SkedGo Pty Ltd. All rights reserved. // -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import Foundation import UIKit diff --git a/Sources/TripKit/core/Loc+TripKit.swift b/Sources/TripKit/core/Loc+TripKit.swift index 2ecd2e68a..9845f6f96 100644 --- a/Sources/TripKit/core/Loc+TripKit.swift +++ b/Sources/TripKit/core/Loc+TripKit.swift @@ -8,7 +8,7 @@ import Foundation -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #endif @@ -168,7 +168,7 @@ extension Loc { } public static func fromTime(_ from: String, toTime to: String) -> String { -#if os(iOS) || os(tvOS) +#if canImport(UIKit) switch UIView.userInterfaceLayoutDirection(for: .unspecified) { case .leftToRight: return String(format: "%@ → %@", from, to) diff --git a/Sources/TripKit/core/TKCrossPlatform.swift b/Sources/TripKit/core/TKCrossPlatform.swift index 7ddb5fcd6..245065b9c 100644 --- a/Sources/TripKit/core/TKCrossPlatform.swift +++ b/Sources/TripKit/core/TKCrossPlatform.swift @@ -8,12 +8,12 @@ import Foundation -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit public typealias TKColor = UIColor public typealias TKImage = UIImage public typealias TKFont = UIFont -#elseif os(OSX) +#elseif canImport(AppKit) import AppKit public typealias TKColor = NSColor public typealias TKImage = NSImage diff --git a/Sources/TripKit/core/TKImage+TripKit.swift b/Sources/TripKit/core/TKImage+TripKit.swift index 5f81558c7..cb24e6abc 100644 --- a/Sources/TripKit/core/TKImage+TripKit.swift +++ b/Sources/TripKit/core/TKImage+TripKit.swift @@ -62,10 +62,10 @@ extension TKImage { private static func named(_ name: String) -> TKImage { - #if os(iOS) || os(tvOS) +#if canImport(UIKit) return TKImage(named: name, in: .tripKit, compatibleWith: nil)! - #elseif os(OSX) +#elseif os(macOS) return TripKit.bundle.image(forResource: name)! - #endif +#endif } } diff --git a/Sources/TripKit/helpers/TKImageBuilder.swift b/Sources/TripKit/helpers/TKImageBuilder.swift index aa6bd9262..aceea06d0 100644 --- a/Sources/TripKit/helpers/TKImageBuilder.swift +++ b/Sources/TripKit/helpers/TKImageBuilder.swift @@ -8,7 +8,7 @@ import Foundation -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit class TKImageBuilder { diff --git a/Sources/TripKit/managers/TKCalendarManager+Autocompleting.swift b/Sources/TripKit/managers/TKCalendarManager+Autocompleting.swift index 859486ae3..a0223685a 100644 --- a/Sources/TripKit/managers/TKCalendarManager+Autocompleting.swift +++ b/Sources/TripKit/managers/TKCalendarManager+Autocompleting.swift @@ -59,7 +59,7 @@ extension TKCalendarManager: TKAutocompleting { } } - #if os(iOS) || os(tvOS) +#if os(iOS) || os(tvOS) || os(visionOS) @objc public func additionalActionTitle() -> String? { if isAuthorized { return nil } @@ -70,7 +70,7 @@ extension TKCalendarManager: TKAutocompleting { public func triggerAdditional(presenter: UIViewController, completion: @escaping (Bool) -> Void) { tryAuthorization(in: presenter, completion: completion) } - #endif +#endif } diff --git a/Sources/TripKit/managers/TKContactsManager+TKAutocompleting.swift b/Sources/TripKit/managers/TKContactsManager+TKAutocompleting.swift index 86216da32..22554e1c1 100644 --- a/Sources/TripKit/managers/TKContactsManager+TKAutocompleting.swift +++ b/Sources/TripKit/managers/TKContactsManager+TKAutocompleting.swift @@ -52,7 +52,7 @@ extension TKContactsManager: TKAutocompleting { } } - #if os(iOS) || os(tvOS) +#if os(iOS) || os(tvOS) || os(visionOS) @objc public func additionalActionTitle() -> String? { if isAuthorized { return nil } @@ -63,7 +63,7 @@ extension TKContactsManager: TKAutocompleting { public func triggerAdditional(presenter: UIViewController, completion: @escaping (Bool) -> Void) { tryAuthorization(in: presenter, completion: completion) } - #endif +#endif private static func geocode(_ contact: ContactAddress, completion: @escaping (Result) -> Void) { let geocoder = CLGeocoder() diff --git a/Sources/TripKit/managers/TKContactsManager.swift b/Sources/TripKit/managers/TKContactsManager.swift index a3ee7805f..75fb08b61 100644 --- a/Sources/TripKit/managers/TKContactsManager.swift +++ b/Sources/TripKit/managers/TKContactsManager.swift @@ -81,12 +81,12 @@ public class TKContactsManager: NSObject, TKPermissionManager { guard isAuthorized else { return [] } - #if os(iOS) || os(tvOS) - return [] // not yet supported - #elseif os(OSX) +#if os(macOS) let contact = try store.unifiedMeContactWithKeys(toFetch: TKContactsManager.keysToFetch) return contact.toContactAddresses().filter { $0.matches(kind) } - #endif +#else + return [] // not yet supported +#endif } // MARK: - TKPermissionManager @@ -130,12 +130,12 @@ extension CNContact { } fileprivate func circularThumbnail() -> TKImage? { - #if os(iOS) || os(tvOS) +#if canImport(UIKit) guard let data = thumbnailImageData, let thumbnail = TKImage(data: data) else { return nil } return TKImageBuilder.drawCircularImage(insideImage: thumbnail) - #elseif os(OSX) +#else return nil - #endif +#endif } } diff --git a/Sources/TripKit/managers/TKPermissionManager+AuthorizationAlert.swift b/Sources/TripKit/managers/TKPermissionManager+AuthorizationAlert.swift index 90c70cae7..12933004c 100644 --- a/Sources/TripKit/managers/TKPermissionManager+AuthorizationAlert.swift +++ b/Sources/TripKit/managers/TKPermissionManager+AuthorizationAlert.swift @@ -8,7 +8,7 @@ import Foundation -#if os(iOS) +#if canImport(UIKit) import UIKit extension TKPermissionManager { diff --git a/Sources/TripKit/managers/TKStyleManager.swift b/Sources/TripKit/managers/TKStyleManager.swift index 65a3ae0de..95bee7177 100644 --- a/Sources/TripKit/managers/TKStyleManager.swift +++ b/Sources/TripKit/managers/TKStyleManager.swift @@ -8,16 +8,16 @@ import Foundation -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #endif extension TKColor { @objc public static var routeDashColorNonTravelled: TKColor { -#if os(iOS) || os(tvOS) +#if canImport(UIKit) return .secondarySystemFill -#elseif os(OSX) +#else return TKColor.lightGray.withAlphaComponent(0.25) #endif } @@ -68,12 +68,12 @@ extension TKStyleManager { public static func activityImage(_ partial: String) -> TKImage { let name: String -#if os(iOS) || os(tvOS) +#if canImport(UIKit) switch UIDevice.current.userInterfaceIdiom { case .phone: name = "icon-actionBar-\(partial)-30" default: name = "icon-actionBar-\(partial)-38" } -#elseif os(OSX) +#else name = "icon-actionBar-\(partial)-38" #endif return image(named: name) @@ -86,10 +86,12 @@ extension TKStyleManager { } public static func optionalImage(named: String) -> TKImage? { -#if os(iOS) || os(tvOS) +#if canImport(UIKit) return TKImage(named: named, in: .tripKit, compatibleWith: nil) -#elseif os(OSX) +#elseif os(macOS) return TripKit.bundle.image(forResource: named) +#else + return nil #endif } @@ -174,7 +176,7 @@ extension TKStyleManager { } } -#if os(iOS) || os(tvOS) +#if canImport(UIKit) //// This method returns a font with custom font face for a given text style and weight. /// If there's no custom font face specified in the plist, system font face is used. /// This method is typically used on `UILabel`, `UITextField`, and `UITextView` but @@ -213,7 +215,7 @@ extension TKStyleManager { return font(size: size, weight: .medium) } -#if os(iOS) || os(tvOS) +#if canImport(UIKit) // @available(*, deprecated, renamed: "font(textStyle:weight:)") public static func customFont(forTextStyle textStyle: UIFont.TextStyle) -> UIFont { return font(textStyle: textStyle, weight: .regular) diff --git a/Sources/TripKit/model/API/BaseAPIModels.swift b/Sources/TripKit/model/API/BaseAPIModels.swift index 194f1a07a..beec0db7f 100644 --- a/Sources/TripKit/model/API/BaseAPIModels.swift +++ b/Sources/TripKit/model/API/BaseAPIModels.swift @@ -83,7 +83,7 @@ extension TKAPI { return TKColor(red: CGFloat(red) / 255, green: CGFloat(green) / 255, blue: CGFloat(blue) / 255, alpha: 1) } - #if os(iOS) || os(tvOS) +#if canImport(UIKit) public init?(for color: TKColor?) { guard let color = color else { return nil } var red: CGFloat = 0 @@ -97,7 +97,7 @@ extension TKAPI { return nil } } - #elseif os(OSX) +#elseif canImport(AppKit) public init?(for color: TKColor?) { guard let color = color else { return nil } var red: CGFloat = 0 @@ -108,7 +108,7 @@ extension TKAPI { self.green = Int(green * 255) self.blue = Int(blue * 255) } - #endif +#endif } } diff --git a/Sources/TripKit/model/CoreData/Shape+CoreDataClass.swift b/Sources/TripKit/model/CoreData/Shape+CoreDataClass.swift index 09cd528c3..93f6404dc 100644 --- a/Sources/TripKit/model/CoreData/Shape+CoreDataClass.swift +++ b/Sources/TripKit/model/CoreData/Shape+CoreDataClass.swift @@ -176,7 +176,7 @@ extension Shape: TKDisplayableRoute { return color } - #if os(iOS) || os(tvOS) +#if os(iOS) || os(tvOS) || os(visionOS) if let bestTag = roadTags?.first { return bestTag.safety.color } @@ -187,7 +187,7 @@ extension Shape: TKDisplayableRoute { if segment?.distanceByRoadTags != nil { return RoadTag.other.safety.color } - #endif +#endif switch friendliness { case .friendly, .unfriendly, .dismount: diff --git a/Sources/TripKit/model/CoreData/Shape+Data.swift b/Sources/TripKit/model/CoreData/Shape+Data.swift index 124e90a52..967d83673 100644 --- a/Sources/TripKit/model/CoreData/Shape+Data.swift +++ b/Sources/TripKit/model/CoreData/Shape+Data.swift @@ -8,7 +8,7 @@ import Foundation -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #endif @@ -30,7 +30,7 @@ extension Shape { case unknown - #if os(iOS) || os(tvOS) +#if canImport(UIKit) public var color: UIColor { switch self { case .safe: return .tkStateSuccess @@ -40,7 +40,7 @@ extension Shape { case .unknown: return .systemGray } } - #endif +#endif } public enum RoadTag: String, Codable { diff --git a/Sources/TripKit/model/CoreData/StopLocation.swift b/Sources/TripKit/model/CoreData/StopLocation.swift index 7d1c46a75..1952565ee 100644 --- a/Sources/TripKit/model/CoreData/StopLocation.swift +++ b/Sources/TripKit/model/CoreData/StopLocation.swift @@ -48,7 +48,7 @@ extension StopLocation: MKAnnotation { // MARK: - UIActivityItemSource -#if os(iOS) +#if canImport(UIKit) extension StopLocation: UIActivityItemSource { public func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any { diff --git a/Sources/TripKit/model/CoreData/StopVisits+CoreDataClass.swift b/Sources/TripKit/model/CoreData/StopVisits+CoreDataClass.swift index 7fa741596..1157309d8 100644 --- a/Sources/TripKit/model/CoreData/StopVisits+CoreDataClass.swift +++ b/Sources/TripKit/model/CoreData/StopVisits+CoreDataClass.swift @@ -14,7 +14,7 @@ import CoreData import CoreLocation import MapKit -#if os(iOS) +#if canImport(UIKit) import UIKit #endif @@ -286,7 +286,7 @@ extension StopVisits: TKRealTimeUpdatable { // MARK: - UIActivityItemSource -#if os(iOS) +#if canImport(UIKit) extension StopVisits: UIActivityItemSource { diff --git a/Sources/TripKit/model/CoreData/Trip+CoreDataClass.swift b/Sources/TripKit/model/CoreData/Trip+CoreDataClass.swift index 197b19799..88337f4d1 100644 --- a/Sources/TripKit/model/CoreData/Trip+CoreDataClass.swift +++ b/Sources/TripKit/model/CoreData/Trip+CoreDataClass.swift @@ -13,7 +13,7 @@ import Foundation import CoreData import MapKit -#if os(iOS) +#if canImport(UIKit) import UIKit #endif @@ -476,7 +476,7 @@ extension Trip { // MARK: - Accessibility -#if os(iOS) +#if canImport(UIKit) extension Trip { public override var accessibilityLabel: String? { get { @@ -542,7 +542,7 @@ extension Trip: TKRealTimeUpdatable { // MARK: - UIActivityItemSource -#if os(iOS) +#if canImport(UIKit) extension Trip: UIActivityItemSource { diff --git a/Sources/TripKit/model/CoreData/TripGroup+CoreDataClass.swift b/Sources/TripKit/model/CoreData/TripGroup+CoreDataClass.swift index 952f296bb..ffc0035fb 100644 --- a/Sources/TripKit/model/CoreData/TripGroup+CoreDataClass.swift +++ b/Sources/TripKit/model/CoreData/TripGroup+CoreDataClass.swift @@ -100,7 +100,7 @@ extension TripGroup { // MARK: - Accessibility -#if os(iOS) +#if canImport(UIKit) extension TripGroup { public override var accessibilityLabel: String? { get { diff --git a/Sources/TripKit/model/TKSegment.swift b/Sources/TripKit/model/TKSegment.swift index 0d72f05f1..f38c5387a 100644 --- a/Sources/TripKit/model/TKSegment.swift +++ b/Sources/TripKit/model/TKSegment.swift @@ -662,7 +662,7 @@ extension TKSegment { // MARK: - UIActivityItemSource -#if os(iOS) +#if canImport(UIKit) extension TKSegment: UIActivityItemSource { diff --git a/Sources/TripKit/search/TKGeocoding.swift b/Sources/TripKit/search/TKGeocoding.swift index e0b0d8454..8c0e128f0 100644 --- a/Sources/TripKit/search/TKGeocoding.swift +++ b/Sources/TripKit/search/TKGeocoding.swift @@ -56,7 +56,7 @@ public protocol TKAutocompleting { /// up resources. func cancelAutocompletion() - #if os(iOS) || os(tvOS) +#if os(iOS) || os(tvOS) || os(visionOS) /// Text and action for an additional row to display in the results, e.g., to request /// user permissions if the autocompletion provider can't provide results without that. /// @@ -66,7 +66,7 @@ public protocol TKAutocompleting { func triggerAdditional(presenter: UIViewController, completion: @escaping (Bool) -> Void) - #endif +#endif var allowLocationInfoButton: Bool { get } @@ -83,7 +83,7 @@ extension TKAutocompleting { public func cancelAutocompletion() {} - #if os(iOS) || os(tvOS) +#if os(iOS) || os(tvOS) || os(visionOS) public func additionalActionTitle() -> String? { return nil } @@ -92,6 +92,6 @@ extension TKAutocompleting { assertionFailure() completion(false) } - #endif +#endif } diff --git a/Sources/TripKit/search/TKModeImageBuilder.swift b/Sources/TripKit/search/TKModeImageBuilder.swift index 0bed9bec6..227447356 100644 --- a/Sources/TripKit/search/TKModeImageBuilder.swift +++ b/Sources/TripKit/search/TKModeImageBuilder.swift @@ -36,12 +36,12 @@ public class TKModeImageFactory: NSObject { private func buildImage(for modeInfo: TKModeInfo) -> TKImage? { guard let overlayImage = modeInfo.image else { return nil } - #if os(iOS) || os(tvOS) +#if canImport(UIKit) return TKImageBuilder.drawCircularImage(insideOverlay: overlayImage, background: #colorLiteral(red: 0.795085609, green: 0.8003450036, blue: 0.7956672311, alpha: 1)) - #elseif os(OSX) +#elseif os(macOS) return nil - #endif +#endif } } diff --git a/Sources/TripKit/server/TKServer+ModeImage.swift b/Sources/TripKit/server/TKServer+ModeImage.swift index 8fa0586a7..cf5863160 100644 --- a/Sources/TripKit/server/TKServer+ModeImage.swift +++ b/Sources/TripKit/server/TKServer+ModeImage.swift @@ -8,9 +8,9 @@ import Foundation -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit -#else +#elseif canImport(AppKit) import AppKit #endif @@ -59,9 +59,9 @@ extension TKServer { let fileExtension = isPNG ? "png" : "svg" if isPNG { let scale: CGFloat -#if os(iOS) || os(tvOS) +#if canImport(UIKit) scale = UIScreen.main.scale -#elseif os(OSX) +#elseif canImport(AppKit) scale = NSScreen.main?.backingScaleFactor ?? 1 #endif diff --git a/Sources/TripKit/sharing/TKShareURLProvider.swift b/Sources/TripKit/sharing/TKShareURLProvider.swift index 4724d8d55..97f9deae4 100644 --- a/Sources/TripKit/sharing/TKShareURLProvider.swift +++ b/Sources/TripKit/sharing/TKShareURLProvider.swift @@ -23,7 +23,7 @@ extension TKAPI { } } -#if os(iOS) +#if canImport(UIKit) import UIKit import CoreData diff --git a/Sources/TripKit/vendor/ASPolygonKit/QuickLookable.swift b/Sources/TripKit/vendor/ASPolygonKit/QuickLookable.swift index d3336936d..cf7c26985 100644 --- a/Sources/TripKit/vendor/ASPolygonKit/QuickLookable.swift +++ b/Sources/TripKit/vendor/ASPolygonKit/QuickLookable.swift @@ -9,10 +9,10 @@ import Foundation #if canImport(CoreGraphics) -#if os(iOS) || os(tvOS) - import UIKit -#elseif os(OSX) - import AppKit +#if canImport(UIKit) +import UIKit +#elseif canImport(AppKit) +import AppKit #endif extension Polygon { diff --git a/Sources/TripKitInterApp/Supporting Files/TripKitInterApp.h b/Sources/TripKitInterApp/Supporting Files/TripKitInterApp.h deleted file mode 100644 index 2c917f226..000000000 --- a/Sources/TripKitInterApp/Supporting Files/TripKitInterApp.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// TripKitInterApp_iOS.h -// TripKitInterApp-iOS -// -// Created by Adrian Schönig on 08.02.18. -// Copyright © 2018 SkedGo. All rights reserved. -// - -#import - -//! Project version number for TripKitInterApp_iOS. -FOUNDATION_EXPORT double TripKitInterApp_iOSVersionNumber; - -//! Project version string for TripKitInterApp_iOS. -FOUNDATION_EXPORT const unsigned char TripKitInterApp_iOSVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import diff --git a/Sources/TripKitUI/Supporting Files/TripKitUI.h b/Sources/TripKitUI/Supporting Files/TripKitUI.h deleted file mode 100644 index ce82af626..000000000 --- a/Sources/TripKitUI/Supporting Files/TripKitUI.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// TripKitUI_iOS.h -// TripKitUI-iOS -// -// Created by Adrian Schönig on 08.02.18. -// Copyright © 2018 SkedGo. All rights reserved. -// - -#import - -//! Project version number for TripKitUI_iOS. -FOUNDATION_EXPORT double TripKitUI_iOSVersionNumber; - -//! Project version string for TripKitUI_iOS. -FOUNDATION_EXPORT const unsigned char TripKitUI_iOSVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import diff --git a/Sources/TripKitUI/helper/RxTripKit/NSManagedObjectContext+Rx.swift b/Sources/TripKitUI/helper/RxTripKit/NSManagedObjectContext+Rx.swift index 7296f70d9..3c77c3599 100644 --- a/Sources/TripKitUI/helper/RxTripKit/NSManagedObjectContext+Rx.swift +++ b/Sources/TripKitUI/helper/RxTripKit/NSManagedObjectContext+Rx.swift @@ -11,7 +11,7 @@ import CoreData import RxSwift -#if os(iOS) +#if os(iOS) || os(tvOS) || os(visionOS) fileprivate class FetchedResultsControllerDelegateProxy: NSObject, NSFetchedResultsControllerDelegate { diff --git a/Sources/TripKitUI/views/map annotations/TKUIAnnotations+TripKit.swift b/Sources/TripKitUI/views/map annotations/TKUIAnnotations+TripKit.swift index 80aa193ff..8b5037cdf 100644 --- a/Sources/TripKitUI/views/map annotations/TKUIAnnotations+TripKit.swift +++ b/Sources/TripKitUI/views/map annotations/TKUIAnnotations+TripKit.swift @@ -30,11 +30,11 @@ extension TKModeCoordinate: TKUIGlyphableAnnotation { public var glyphImage: TKImage? { let image = stopModeInfo.image - #if os(iOS) || os(tvOS) +#if canImport(UIKit) return image?.withRenderingMode(.alwaysTemplate) - #else +#else return image - #endif +#endif } public var glyphImageURL: URL? { diff --git a/TripKit.xcodeproj/project.pbxproj b/TripKit.xcodeproj/project.pbxproj index 2635c9706..7e241f78f 100644 --- a/TripKit.xcodeproj/project.pbxproj +++ b/TripKit.xcodeproj/project.pbxproj @@ -1324,7 +1324,6 @@ 3AFF271626C6975F007809CD /* Alert+TKAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Alert+TKAlert.swift"; sourceTree = ""; }; 3AFF271726C6975F007809CD /* TKUISheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TKUISheetViewController.swift; sourceTree = ""; }; 3AFF271826C6975F007809CD /* TripKitUIBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TripKitUIBundle.swift; sourceTree = ""; }; - 3AFF271A26C6975F007809CD /* TripKitUI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TripKitUI.h; sourceTree = ""; }; 3AFF271B26C6975F007809CD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 3AFF271D26C6975F007809CD /* TKUITimetableViewModel+Content.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TKUITimetableViewModel+Content.swift"; sourceTree = ""; }; 3AFF271E26C6975F007809CD /* TKUIRoutingResultsViewModel+RealTime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TKUIRoutingResultsViewModel+RealTime.swift"; sourceTree = ""; }; @@ -1520,7 +1519,6 @@ 3AFF282926C6975F007809CD /* TKInterAppExternalActionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TKInterAppExternalActionHandler.swift; sourceTree = ""; }; 3AFF282A26C6975F007809CD /* TKInterAppCommunicator+TurnByTurn.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TKInterAppCommunicator+TurnByTurn.swift"; sourceTree = ""; }; 3AFF282B26C6975F007809CD /* TKConfig+TKInterAppCommunicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TKConfig+TKInterAppCommunicator.swift"; sourceTree = ""; }; - 3AFF282D26C6975F007809CD /* TripKitInterApp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TripKitInterApp.h; sourceTree = ""; }; 3AFF282E26C6975F007809CD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 3AFF283026C6975F007809CD /* TKPhoneActionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TKPhoneActionHandler.swift; sourceTree = ""; }; 3AFF283126C6975F007809CD /* TKWebActionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TKWebActionHandler.swift; sourceTree = ""; }; @@ -2393,7 +2391,6 @@ 3AFF271926C6975F007809CD /* Supporting Files */ = { isa = PBXGroup; children = ( - 3AFF271A26C6975F007809CD /* TripKitUI.h */, 3AFF271B26C6975F007809CD /* Info.plist */, ); path = "Supporting Files"; @@ -2739,7 +2736,6 @@ 3AFF282C26C6975F007809CD /* Supporting Files */ = { isa = PBXGroup; children = ( - 3AFF282D26C6975F007809CD /* TripKitInterApp.h */, 3AFF282E26C6975F007809CD /* Info.plist */, ); path = "Supporting Files"; @@ -4215,7 +4211,6 @@ CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; - DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -4254,7 +4249,6 @@ CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; - DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -4289,7 +4283,6 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -4323,7 +4316,6 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -4357,7 +4349,6 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -4388,7 +4379,6 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath";