Oddbean new post about | logout
 # NOSTR SDK FOR APPLE PLATFORMS
## Progress Report # 1: Aug - Oct 2024

Nostr SDK for Apple Platforms made great strides this quarter. I was the sole developer who maintained Nostr SDK for Apple Platforms part-time, as the other core contributors, unfortunately, could not commit time to developing or reviewing code for the project.

Approximately 50% of the tasks listed in the original OpenSats application have been completed. Moreover, implementations of several other NIPs / event kinds not listed in the application were fixed or added.

There was a substantial architecture change in how Nostr event kinds are built to improve the project's code maintainability and scalability as more NIPs and event kinds are supported. Specifically, certain event kinds support several handfuls of tags, some of which have complex logic. This requirement resulted in the introduction of a large, unmaintainable number of parameters in event creation methods in the EventCreating protocol. Multiple event kinds share some tags, but the EventCreating architecture made it difficult to share logic. By deprecating the EventCreating protocol in favor of the NostrEventBuilding protocol, we can encourage a composable architecture: decompose each event kind tag into a separate builder function, and tags shared across multiple event kinds can re-use the same code. This architecture change has and will pay dividends in future changes. For example, labels, custom emojis, and threading are concepts and tags shared across multiple event kinds, and their implementation has been made substantially more manageable with this architecture. [Vitor Pamplona](nostr:nprofile1qqsyvrp9u6p0mfur9dfdru3d853tx9mdjuhkphxuxgfwmryja7zsvhqpp4mhxue69uhkummn9ekx7mqpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxg62fzjm), developer of Amethyst, applauded the architecture design by [saying](nostr:nevent1qqsqxprj929t8fy7us500dw2zd94vy9u42gj0d6s6u45c7ldpmn922qpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxgqgdwaehxw309ahx7uewd3hkcq3qyaul8k059377u9lsu67de7y637w4jtgeuwcmh5n7788l6xnlnrgsjpz08r): `It's nice indeed. I will be copying your SDK patterns on Kotlin :)`

I battle-tested Nostr SDK for Apple Platforms in the wild by integrating it into [Comingle iOS](https://github.com/comingle-co/comingle-ios), an events app powered by Nostr, solely developed by me. It was [launched](nostr:nevent1qqsqhwedcrm08d6n6fq3ujhvn5adz8u2qfyps6lm62phre7f825j4mgpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxgqgdwaehxw309ahx7uewd3hkcqg5waehxw309aex2mrp0yhxgctdw4eju6t0qgsv8e5c93le8ezrmx0j6gkr6m7xhfs5wkh3r08j38uj0faeqhllu5ghahk3n) and used at [Nostriga](nostr:nevent1qqsgvl66smkyssur368cgytt5uzcl3t76jq2xpkg356367eprmldjagpp4mhxue69uhkummn9ekx7mqzyrp7dxpv07f7gs7enukj9s7kl346v9r44ugmeu5flyn60wg9lll9zqjd8ha) in August 2024 for attendees to see the conference schedule and RSVP to talks. It proved that a developer could quickly use the SDK to build a functional iOS app on Nostr using Swift.

## 1) How did you spend your time?

Below is a broken-down summarized bulletpointed list of completed tasks.

### Development of Nostr SDK for Apple Platforms

#### Added

- [NIP-17 Private Direct Messages](https://github.com/nostr-sdk/nostr-sdk-ios/pull/191)
- [NIP-31 alt tags](https://github.com/nostr-sdk/nostr-sdk-ios/pull/194)
- [NIP-32 Labeling](https://github.com/nostr-sdk/nostr-sdk-ios/pull/195)
- [NIP-36 Sensitive Content / Content Warning](https://github.com/nostr-sdk/nostr-sdk-ios/pull/196)
- [NIP-40 Expiration Timestamp](https://github.com/nostr-sdk/nostr-sdk-ios/pull/193)
- [Add NostrEventBuilding protocol to enable flexible composition of shared patterns across different kinds of NostrEvents](https://github.com/nostr-sdk/nostr-sdk-ios/pull/175)
- [Add Swift 6.0 to unit tests](https://github.com/nostr-sdk/nostr-sdk-ios/pull/179)
- [Integration into Comingle iOS client to battle-test SDK](https://github.com/comingle-co/comingle-ios/commits/main/?since=2024-08-01&until=2024-08-31)

#### Updated

- [NIP-01 - Add missing test coverage for referencedEventIds and referencedPubkeys functions in TextNoteEventTests](https://github.com/nostr-sdk/nostr-sdk-ios/pull/187)
- [NIP-01 - Add referencedPubkeys, referencedEventIds, and referencedEventCoordinates to NostrEvent](https://github.com/nostr-sdk/nostr-sdk-ios/pull/188)
- [NIP-01 - Fix incorrect test fixture and assertions in TextNoteEventTests for replies](https://github.com/nostr-sdk/nostr-sdk-ios/pull/189)
- [NIP-10 - Refactor threaded event tag building and interpreting logic so non-kind-1 events can reuse them](https://github.com/nostr-sdk/nostr-sdk-ios/pull/186)
- [NIP-25 Reactions - Add ReactionEvent.Builder to deprecate equivalent function in EventCreating](https://github.com/nostr-sdk/nostr-sdk-ios/pull/177)
- [NIP-42 Authentication - Add AuthenticationEvent.Builder to deprecate equivalent function in EventCreating](https://github.com/nostr-sdk/nostr-sdk-ios/pull/183)
- [NIP-42 - Deprecate AuthenticationEvent initializer in favor of AuthenticationEvent.Builder](https://github.com/nostr-sdk/nostr-sdk-ios/pull/190)
- [NIP-59 Gift Wrap - Add support for receiver aliases for gift wrap creation to avoid exposing identities and improve test coverage](https://github.com/nostr-sdk/nostr-sdk-ios/pull/184)
- [Fix GitHub workflows to trigger on pull_request_target so that they can run on PRs from public forks](https://github.com/nostr-sdk/nostr-sdk-ios/pull/173)
- [Expose RelayResponse.Message and RelayResponse.MessagePrefix as public](https://github.com/nostr-sdk/nostr-sdk-ios/pull/174)
- [Fix SwiftLint errors from latest SwiftLint release](https://github.com/nostr-sdk/nostr-sdk-ios/pull/180)
- [Fix GitHub workflows to also run on main branch](https://github.com/nostr-sdk/nostr-sdk-ios/pull/181)
- [Update README with current list of NIPs](https://github.com/nostr-sdk/nostr-sdk-ios/pull/182)

#### In Progress

- [NIP-28 Public Chat - Review pull request from external contributor developing Skatepay](https://github.com/nostr-sdk/nostr-sdk-ios/pull/178)
- [NIP-57 Lightning Zaps](https://github.com/nostr-sdk/nostr-sdk-ios/compare/main...tyiu/zaps)
- Deprecate EventCreating protocol in favor of NostrEventBuilding protocol for the remaining event kinds

## 2) What do you plan to work on next quarter?

The remaining items in the original application to OpenSats include:
- Deprecate EventCreating protocol in favor of NostrEventBuilding protocol for the remaining event kinds
- Provide better support for integrating data models with persistence layers
- Add unit tests and graceful handling for bad data from relays
- Outbox model support / relay abstraction on top of events
- Integrate demo app with more implemented NIPs
- Integrate Nostr SDK for Apple Platforms further into Comingle iOS for further battle-testing
- Support Damus, Nos.social, Primal, and other clients as they integrate with parts of the SDK by answering questions, fixing any issues they have, adding requested features, and reviewing pull requests
- Consider integrating SDK NIP-44 v2 encryption or NIP-17 DMs with Damus iOS to battle-test implementation and push for deprecation of NIP-04 DMs
- [NIP-28 Public Chat - Review pull request from external contributor developing Skatepay](https://github.com/nostr-sdk/nostr-sdk-ios/pull/178)
- [NIP-47 Nostr Wallet Connect - Review pull request from external contributor](https://github.com/nostr-sdk/nostr-sdk-ios/pull/203)
- [NIP-57 Lightning Zaps](https://github.com/nostr-sdk/nostr-sdk-ios/compare/main...tyiu/zaps)

## 3) How did you make use of the money?

Living expenses. 
 Great process made!! 
 🫡