Skip to content

Commit 88c4924

Browse files
committed
Adapt to macOS 26
1 parent 8325285 commit 88c4924

File tree

57 files changed

+1169
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1169
-156
lines changed

Core/Sources/RuntimeViewerCore/RuntimeImageLoadState.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ public enum RuntimeImageLoadState {
55
case loading
66
case loaded
77
case loadError(Error)
8+
case unknown
89
}

RuntimeViewerPackages/Package.swift

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ let appkitPlatforms: [Platform] = [.macOS]
77

88
let uikitPlatforms: [Platform] = [.iOS, .tvOS, .visionOS]
99

10+
let usingSystemUXKit = true
11+
12+
var sharedSwiftSettings: [SwiftSetting] = []
13+
14+
if usingSystemUXKit {
15+
sharedSwiftSettings.append(.define("USING_SYSTEM_UXKIT"))
16+
}
17+
1018
let package = Package(
1119
name: "RuntimeViewerPackages",
1220
platforms: [
@@ -48,7 +56,7 @@ let package = Package(
4856
),
4957
.package(
5058
url: "https://github.com/Mx-Iris/CocoaCoordinator",
51-
from: "0.3.0"
59+
branch: "main"
5260
),
5361
.package(
5462
url: "https://github.com/SnapKit/SnapKit",
@@ -64,11 +72,11 @@ let package = Package(
6472
),
6573
.package(
6674
url: "https://github.com/Mx-Iris/RxAppKit",
67-
from: "0.2.0"
75+
branch: "main"
6876
),
6977
.package(
7078
url: "https://github.com/OpenUXKit/OpenUXKit",
71-
from: "0.10.0"
79+
branch: "main"
7280
),
7381
.package(
7482
url: "https://github.com/MxIris-Library-Forks/NSAttributedStringBuilder",
@@ -141,25 +149,26 @@ let package = Package(
141149
.product(name: "XCoordinatorRx", package: "XCoordinator", condition: .when(platforms: uikitPlatforms)),
142150
.product(name: "CocoaCoordinator", package: "CocoaCoordinator", condition: .when(platforms: appkitPlatforms)),
143151
.product(name: "RxCocoaCoordinator", package: "CocoaCoordinator", condition: .when(platforms: appkitPlatforms)),
144-
.product(name: "OpenUXKitCoordinator", package: "CocoaCoordinator", condition: .when(platforms: appkitPlatforms)),
145-
// .product(name: "UXKitCoordinator", package: "CocoaCoordinator", condition: .when(platforms: [.macOS])),
146-
]
152+
.product(name: usingSystemUXKit ? "UXKitCoordinator" : "OpenUXKitCoordinator", package: "CocoaCoordinator", condition: .when(platforms: appkitPlatforms)),
153+
],
154+
swiftSettings: sharedSwiftSettings,
147155
),
148156
.target(
149157
name: "RuntimeViewerUI",
150158
dependencies: [
151159
.product(name: "UIFoundation", package: "UIFoundation"),
152160
.product(name: "UIFoundationToolbox", package: "UIFoundation"),
153161
.product(name: "SnapKit", package: "SnapKit"),
154-
.product(name: "OpenUXKit", package: "OpenUXKit", condition: .when(platforms: appkitPlatforms)),
155-
// .product(name: "UXKit", package: "OpenUXKit"),
162+
.product(name: usingSystemUXKit ? "UXKit" : "OpenUXKit", package: "OpenUXKit", condition: .when(platforms: appkitPlatforms)),
156163
.product(name: "NSAttributedStringBuilder", package: "NSAttributedStringBuilder"),
157164
.product(name: "SFSymbol", package: "SFSymbol"),
158165
.product(name: "IDEIcons", package: "ide-icons"),
159166
.product(name: "FilterUI", package: "filter-ui", condition: .when(platforms: appkitPlatforms)),
160167
.product(name: "Rearrange", package: "Rearrange", condition: .when(platforms: appkitPlatforms)),
161168
.product(name: "RunningApplicationKit", package: "RunningApplicationKit", condition: .when(platforms: appkitPlatforms)),
162-
]
169+
.product(name: "UIFoundationAppleInternalObjC", package: "UIFoundation"),
170+
],
171+
swiftSettings: sharedSwiftSettings,
163172
),
164173
.target(
165174
name: "RuntimeViewerApplication",

RuntimeViewerPackages/Sources/RuntimeViewerApplication/Sidebar/SidebarImageViewModel.swift

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class SidebarImageViewModel: ViewModel<SidebarRoute> {
2222
@Observed private var searchScope: RuntimeTypeSearchScope = .all
2323
@Observed private var runtimeObjects: [RuntimeObjectName] = []
2424
@Observed private var filteredRuntimeObjects: [RuntimeObjectName] = []
25-
@Observed private var loadState: RuntimeImageLoadState = .notLoaded
25+
@Observed private var loadState: RuntimeImageLoadState = .unknown
2626

2727
public init(node namedNode: RuntimeNamedNode, appServices: AppServices, router: any Router<SidebarRoute>) {
2828
self.runtimeEngine = appServices.runtimeEngine
@@ -31,7 +31,7 @@ public class SidebarImageViewModel: ViewModel<SidebarRoute> {
3131
self.imagePath = imagePath
3232
self.imageName = namedNode.name
3333
super.init(appServices: appServices, router: router)
34-
34+
3535
Task {
3636
do {
3737
let loadState: RuntimeImageLoadState = try await runtimeEngine.isImageLoaded(path: imagePath) ? .loaded : .notLoaded
@@ -42,43 +42,22 @@ public class SidebarImageViewModel: ViewModel<SidebarRoute> {
4242
let swiftEnumNames = try await runtimeEngine.names(of: .swift(.enum), in: imagePath)
4343
let swiftStructNames = try await runtimeEngine.names(of: .swift(.struct), in: imagePath)
4444
await MainActor.run {
45-
4645
let searchString = ""
4746
let searchScope: RuntimeTypeSearchScope = .all
4847

4948
self.searchString = searchString
5049
self.searchScope = searchScope
51-
50+
5251
self.runtimeObjects = objcClassNames + objcProtocolNames + swiftEnumNames + swiftStructNames + swiftClassNames + swiftProtocolNames
5352
self.filteredRuntimeObjects = self.runtimeObjects.sorted()
54-
// self.runtimeObjects = Self.runtimeObjectsFor(
55-
// classNames: classNames, protocolNames: protocolNames,
56-
// searchString: searchString, searchScope: searchScope
57-
// )
5853

5954
self.loadState = loadState
6055
}
6156

62-
63-
// $searchScope
64-
// .asPublisher()
65-
// .combineLatest(debouncedSearch.asPublisher(), $classNames.asPublisher(), $protocolNames.asPublisher()) {
66-
// Self.runtimeObjectsFor(
67-
// classNames: $2, protocolNames: $3,
68-
// searchString: $1, searchScope: $0
69-
// )
70-
// }
71-
// .asObservable()
72-
// .map { $0.sorted() }
73-
// .bind(to: $runtimeObjects)
74-
// .disposed(by: rx.disposeBag)
75-
7657
let debouncedSearch = $searchString
7758
.debounce(.milliseconds(80), scheduler: MainScheduler.instance)
7859
.asObservable()
79-
80-
81-
60+
8261
debouncedSearch
8362
.withLatestFrom($runtimeObjects.asObservable()) { (searchString: String, runtimeObjects: [RuntimeObjectName]) -> [RuntimeObjectName] in
8463
if searchString.isEmpty {
@@ -89,7 +68,7 @@ public class SidebarImageViewModel: ViewModel<SidebarRoute> {
8968
}
9069
.bind(to: $filteredRuntimeObjects)
9170
.disposed(by: rx.disposeBag)
92-
71+
9372
await runtimeEngine.$imageList
9473
.asObservable()
9574
.flatMap { [unowned self] imageList in
@@ -102,6 +81,7 @@ public class SidebarImageViewModel: ViewModel<SidebarRoute> {
10281
.bind(to: $loadState)
10382
.disposed(by: rx.disposeBag)
10483
} catch {
84+
loadState = .loadError(error)
10585
print(error)
10686
}
10787
}
@@ -131,7 +111,6 @@ public class SidebarImageViewModel: ViewModel<SidebarRoute> {
131111

132112
@MainActor
133113
public func transform(_ input: Input) -> Output {
134-
135114
input.searchString.emit(to: $searchString).disposed(by: rx.disposeBag)
136115

137116
input.runtimeObjectClicked.emitOnNextMainActor { [weak self] viewModel in
@@ -171,7 +150,6 @@ public class SidebarImageViewModel: ViewModel<SidebarRoute> {
171150
isEmpty: $runtimeObjects.asDriver().map { $0.isEmpty },
172151
windowInitialTitles: .just((runtimeNodeName, "")),
173152
windowSubtitle: input.runtimeObjectClicked.asSignal().map { "\($0.runtimeObject.name)" }
174-
175153
)
176154
}
177155

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@_exported import RxSwift
22
@_exported import RxCocoa
3-
//@_exported import RxSwiftExt
3+
4+
// @_exported import RxSwiftExt
45
@_exported import RxSwiftPlus
56
@_exported import RxCombine
67
@_exported import RxDefaultsPlus
@@ -12,19 +13,23 @@
1213
@_exported import RxAppKit
1314
@_exported import CocoaCoordinator
1415
@_exported import RxCocoaCoordinator
16+
#if USING_SYSTEM_UXKIT
17+
@_exported import UXKitCoordinator
18+
#else
1519
@_exported import OpenUXKitCoordinator
16-
//@_exported import UXKitCoordinator
20+
#endif
1721
#endif
1822

1923
#if canImport(UIKit) && !os(macOS)
2024
@_exported import RxUIKit
2125
@_exported import XCoordinator
2226
@_exported import XCoordinatorRx
27+
2328
public typealias Routable = Route
2429
#endif
2530

26-
extension ObservableType {
27-
public func observeOnMainScheduler() -> Observable<Element> {
31+
public extension ObservableType {
32+
func observeOnMainScheduler() -> Observable<Element> {
2833
observe(on: MainScheduler.instance)
2934
}
3035
}

RuntimeViewerPackages/Sources/RuntimeViewerUI/RuntimeViewerUI.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
@_exported import NSAttributedStringBuilder
55
@_exported import SFSymbol
66
@_exported import IDEIcons
7+
@_exported import UIFoundationAppleInternalObjC
78

89
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
10+
#if USING_SYSTEM_UXKIT
11+
@_exported import UXKit
12+
#else
913
@_exported import OpenUXKit
14+
#endif
1015
@_exported import FilterUI
1116
//@_exported import MachInjectorUI
1217
@_exported import RunningApplicationKit

0 commit comments

Comments
 (0)