Skip to content

Commit 70dd000

Browse files
committed
Attempt to port D2SUI to current ZeeQL
This was using a special index based GID for sparse arrays somehow. But the current ZeeQL doesn't support arbitrary GIDs anymore, essentially just KeyGlobalIDs.
1 parent 0936b4d commit 70dd000

File tree

4 files changed

+10
-43
lines changed

4 files changed

+10
-43
lines changed

DirectToSwiftUI.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 52;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXAggregateTarget section */
@@ -1528,7 +1528,7 @@
15281528
repositoryURL = "https://github.com/ZeeQL/ZeeQL3.git";
15291529
requirement = {
15301530
kind = upToNextMajorVersion;
1531-
minimumVersion = 0.8.20;
1531+
minimumVersion = 0.6.16;
15321532
};
15331533
};
15341534
E8F4DF4E233255ED0077B171 /* XCRemoteSwiftPackageReference "ZeeQL3Combine" */ = {

Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ let package = Package(
1818
.package(url: "https://github.com/DirectToSwift/SwiftUIRules.git",
1919
from: "0.2.0"),
2020
.package(url: "https://github.com/ZeeQL/ZeeQL3.git",
21-
from: "0.9.4"),
21+
from: "0.9.16"),
2222
.package(url: "https://github.com/ZeeQL/ZeeQL3Combine.git",
23-
from: "0.1.5")
23+
from: "0.2.0")
2424
],
2525

2626
targets: [

Sources/DirectToSwiftUI/Support/ZeeQL/EntityExtras.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// ZeeQLExtras.swift
33
// ApacheExpressAdmin
44
//
5-
// Copyright © 2017-2019 ZeeZide GmbH. All rights reserved.
5+
// Copyright © 2017-2024 ZeeZide GmbH. All rights reserved.
66
//
77

88
import protocol ZeeQL.Entity
@@ -192,14 +192,13 @@ extension Entity {
192192
* the property keys.
193193
*/
194194
func prefetchPathesForPropertyKeys<S: Sequence>(_ propertyKeys: S)
195-
-> [ String ]? where S.Element == String
195+
-> [ String ] where S.Element == String
196196
{
197197
var pathes = Set<String>()
198198
for propertyKey in propertyKeys {
199199
insertPrefetchPathesForPropertyKey(propertyKey, into: &pathes)
200200
}
201-
if pathes.isEmpty { return nil }
202-
return Array(pathes)
201+
return pathes.sorted()
203202
}
204203

205204
private func insertPrefetchPathesForPropertyKey(_ propertyKey: String,

Sources/DirectToSwiftUI/ViewModel/SparseFaultArray.swift

+3-35
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public struct SparseFaultArray<Object: AnyObject, Resolver: D2SFaultResolver> {
6262
assert(knownObjects.count <= count)
6363
assert(knownObjects.count > position)
6464
}
65-
65+
66+
#if false // no index GIDs anymore
6667
@inline(__always)
6768
fileprivate func makeGlobalID(for index: Int) -> GlobalID {
6869
IndexGlobalID.make(index)
@@ -71,6 +72,7 @@ public struct SparseFaultArray<Object: AnyObject, Resolver: D2SFaultResolver> {
7172
fileprivate func makeFault(for index: Int) -> Element {
7273
return D2SFault(makeGlobalID(for: index), resolver!)
7374
}
75+
#endif
7476

7577
public subscript(globalID: GlobalID) -> Object? {
7678
return objects[globalID]
@@ -128,37 +130,3 @@ extension SparseFaultArray {
128130
}
129131
}
130132
}
131-
132-
internal final class IndexGlobalID : GlobalID {
133-
134-
private static let sharedIndexGIDs : [ IndexGlobalID ] = { // prealloc some
135-
(0...50).map(IndexGlobalID.init)
136-
}()
137-
138-
// TBD: we _could_ scope by something.
139-
public let index : Int
140-
141-
@inlinable
142-
public static func make(_ index: Int) -> IndexGlobalID {
143-
return index < IndexGlobalID.sharedIndexGIDs.count
144-
? IndexGlobalID.sharedIndexGIDs[index]
145-
: IndexGlobalID(index)
146-
}
147-
148-
private init(_ index: Int) {
149-
self.index = index
150-
}
151-
152-
override func isEqual(to object: Any?) -> Bool {
153-
guard let gid = object as? IndexGlobalID else { return false }
154-
return gid == self
155-
}
156-
157-
override func hash(into hasher: inout Hasher) {
158-
index.hash(into: &hasher)
159-
}
160-
161-
public static func ==(lhs: IndexGlobalID, rhs: IndexGlobalID) -> Bool {
162-
return lhs.index == rhs.index
163-
}
164-
}

0 commit comments

Comments
 (0)