Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 13 Support #535

Merged
merged 3 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/obakittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
restore-keys: |
${{ runner.os }}-spm-

- name: Switch Xcode 12
run: sudo xcode-select -switch /Applications/Xcode_12.5.app
- name: Switch Xcode 13
run: sudo xcode-select -switch /Applications/Xcode_13.0.app

- name: Install xcodegen
run: brew install xcodegen
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Build OneBusAway
run: xcodebuild clean build-for-testing
-scheme 'App'
-destination 'platform=iOS Simulator,OS=14.5,name=iPhone 8'
-destination 'platform=iOS Simulator,OS=15.0,name=iPhone 8'
-quiet

# Unit Test
Expand All @@ -42,7 +42,7 @@ jobs:
-only-testing:OBAKitTests
-project 'OBAKit.xcodeproj'
-scheme 'App'
-destination 'platform=iOS Simulator,OS=14.5,name=iPhone 8'
-destination 'platform=iOS Simulator,OS=15.0,name=iPhone 8'
-resultBundlePath OBAKitTests.xcresult
-quiet
- name: Upload OBAKitTests results
Expand All @@ -57,7 +57,7 @@ jobs:
-only-testing:OBAKitUITests
-project 'OBAKit.xcodeproj'
-scheme 'App'
-destination 'platform=iOS Simulator,OS=14.5,name=iPhone 8'
-destination 'platform=iOS Simulator,OS=15.0,name=iPhone 8'
-resultBundlePath OBAKitUITests.xcresult
-quiet

Expand Down
21 changes: 17 additions & 4 deletions OBAKit/Controls/ListView/OBAListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,26 @@ public class OBAListView: UICollectionView, UICollectionViewDelegate {
return obaView
}

func listCell(_ collectionView: UICollectionView, indexPath: IndexPath, item: AnyOBAListViewItem, config: UIListContentConfiguration, accessories: [UICellAccessory?]) -> UICollectionViewListCell? {
let registration = UICollectionView.CellRegistration<UICollectionViewListCell, AnyOBAListViewItem> { cell, _, _ in
cell.contentConfiguration = config
let listCellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, AnyOBAListViewItem> { cell, _, item in
let config = item.configuration
switch config {
case .list(let contentConfig, let accessories):
cell.contentConfiguration = contentConfig
cell.accessories = accessories.compactMap { $0 }
case .custom(let config):
if let listRow = config as? OBAListRowConfiguration {
cell.contentConfiguration = listRow.listConfiguration
if let accessory = listRow.accessoryType.cellAccessory {
cell.accessories = [accessory]
} else {
cell.accessories = []
}
}
}
}

return collectionView.dequeueConfiguredReusableCell(using: registration, for: indexPath, item: item)
func listCell(_ collectionView: UICollectionView, indexPath: IndexPath, item: AnyOBAListViewItem, config: UIListContentConfiguration, accessories: [UICellAccessory?]) -> UICollectionViewListCell? {
return collectionView.dequeueConfiguredReusableCell(using: listCellRegistration, for: indexPath, item: item)
}

// MARK: - Item selection actions
Expand Down
4 changes: 4 additions & 0 deletions OBAKit/Mapping/MapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public class MapViewController: UIViewController,

floatingPanel.addPanel(toParent: self)

if #available(iOS 15.0, *) {
setContentScrollView(floatingPanel.scrollView, for: .bottom)
}

view.insertSubview(toolbar, aboveSubview: mapView)

NSLayoutConstraint.activate([
Expand Down
10 changes: 10 additions & 0 deletions OBAKit/Trip/TripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,23 @@ class TripViewController: UIViewController,
if !isBeingPreviewed {
floatingPanel.addPanel(toParent: self)
}

if #available(iOS 15.0, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithDefaultBackground()
navigationItem.scrollEdgeAppearance = appearance
}
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

disableIdleTimer()
beginUserActivity()

if #available(iOS 15, *) {
setContentScrollView(tripDetailsController.listView, for: .bottom)
}
}

override func viewWillDisappear(_ animated: Bool) {
Expand Down