Oddbean new post about | logout
 @tyiu I'm curious, since you have some experience with our codebase, do you see any high value areas in Nostr SDK that we could take advantage of in Nos? Besides the NIP-44 stuff of course. And do you have any ideas on how you would integrate Nostr SDK with a persistence framework? Is there one other than Core Data that you like? 
 There's a few that you could consider potentially integrating that doesn’t require adopting the NostrEvent data model if you already have your own:

Public and private key creation:
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/Keys.swift

Unrecommended DM spec:
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/DirectMessageEncrypting.swift

Event verification:
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/SignatureVerifying.swift

NIP-05 validation:
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/NIP05Validating.swift

Relay metadata and validation:
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/RelayURLValidating.swift
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/RelayInfo.swift

Web socket and relay management (though we haven't integrated the outbox model yet, and it has some coupling to the NostrEvent data model):
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/WebSocket.swift
https://github.com/nostr-sdk/nostr-sdk-ios/blob/main/Sources/NostrSDK/RelayPool.swift

For further integration with our data models, we haven’t thought through what that might look like with a persistence framework. We’re leaving room for flexibility so that the developer can choose. With that said, it’ll be good to get an idea of what that might look like. I’ll start thinking about it. Tagging in @montzstar as well as he has much more Apple development experience than I do. I know about Realm, SQLite, and Apple recently introduced SwiftData. Though, I don’t know the tradeoffs. 
 That’s a nice list! We already have our own versions of each of these in Nos, but maybe it will make sense to convert to yours at some point. If we were starting an app like Nos from scratch I would definitely pull these in first thing. 
 @mplorentz I was able to successfully and easily use SwiftData in iOS 17 as my persistence layer with the data models from Nostr SDK for Apple Platforms. I just put the NostrEvent or any of the subclasses in as a property into a new class tagged with the @Model macro and it worked. 
 😍 that’s awesome. Are you considering using SwiftData for Comingle? 
 Yes! It’s using it right now. I haven’t measured performance or space usage yet but it seems fine so far.