Closed zhenyab closed 2 years ago
Try with this snippet: (if UUID
conforms to Identifier
then it will work)
if let uuid = UUID(uuidString: deviceId) {
Device.find(id: uuid) { result, error in
guard let result = result else {
Log.warning("No such device with id: \(deviceId)")
return
}
print(result.command)
}
} else {
Log.warning("UUID is not valid: \(deviceId)")
}
Your problem might occurs because you didn't unwrap uuid
, what I've fixed here.
Many thanks for the hint
@zhenyab If it works as expected, you can close the issue.
Context and Description
I use existing database and try to create ORM object to use with it. But I found it is impossible, or may be can't find workaround.
Environment Details
macOS: 10.14.6 Xcode: 10.3 Swift: Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5) Target: x86_64-apple-darwin18.7.0
Steps to Reproduce
2) Later I try to use the object to find entry by id like in following code:
Expected vs. Actual Behaviour
Argument type 'UUID?' does not conform to expected type 'Identifier'
forDevice.find(id: uuid)