Skip to content

Commit

Permalink
Docs fix (#318)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nighthawk authored Nov 24, 2023
1 parent 5434956 commit d0ba31b
Show file tree
Hide file tree
Showing 35 changed files with 90 additions and 130 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/docs-dryrun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,6 +27,7 @@ jobs:
pip install mkdocs
pip install pymdown-extensions
mkdocs --version
bundle install
- name: Build docs
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,6 +27,7 @@ jobs:
pip install mkdocs
pip install pymdown-extensions
mkdocs --version
bundle install
- name: Build docs
run: |
Expand Down
20 changes: 8 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions Scripts/docs/tripkit.jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Scripts/docs/tripkitui.jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ podspec: ../../TripKitUI.podspec

exclude:
- /*/TripKitUI/helper/Categories/*
- /*/TripKitUI/vendor/Differentiator/*
- /*/TripKitUI/vendor/RxDataSources/*
- /*/TripKitUI/vendor/*

custom_categories:
- name: Trip Planning
Expand Down
2 changes: 1 addition & 1 deletion Sources/TripKit/UIKit/TKStyleManager+UIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2021 SkedGo Pty Ltd. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if canImport(UIKit)

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/TripKit/UIKit/UIColor+TripKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2019 SkedGo Pty Ltd. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if canImport(UIKit)

import Foundation
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion Sources/TripKit/UIKit/UIColor+TripKitDefault.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2019 SkedGo Pty Ltd. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if canImport(UIKit)

import Foundation
import UIKit
Expand Down
4 changes: 2 additions & 2 deletions Sources/TripKit/core/Loc+TripKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

#if os(iOS) || os(tvOS)
#if canImport(UIKit)
import UIKit
#endif

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Sources/TripKit/core/TKCrossPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Sources/TripKit/core/TKImage+TripKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
2 changes: 1 addition & 1 deletion Sources/TripKit/helpers/TKImageBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

#if os(iOS) || os(tvOS)
#if canImport(UIKit)
import UIKit

class TKImageBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -70,7 +70,7 @@ extension TKCalendarManager: TKAutocompleting {
public func triggerAdditional(presenter: UIViewController, completion: @escaping (Bool) -> Void) {
tryAuthorization(in: presenter, completion: completion)
}
#endif
#endif

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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<TKNamedCoordinate, Error>) -> Void) {
let geocoder = CLGeocoder()
Expand Down
14 changes: 7 additions & 7 deletions Sources/TripKit/managers/TKContactsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

#if os(iOS)
#if canImport(UIKit)
import UIKit

extension TKPermissionManager {
Expand Down
20 changes: 11 additions & 9 deletions Sources/TripKit/managers/TKStyleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Sources/TripKit/model/API/BaseAPIModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -108,7 +108,7 @@ extension TKAPI {
self.green = Int(green * 255)
self.blue = Int(blue * 255)
}
#endif
#endif
}

}
Expand Down
Loading

0 comments on commit d0ba31b

Please sign in to comment.