# Rust, TypeScript, Swift, and Kotlin codegen and front-end SDK

**URL:** <https://forum.polkadot.network/t/rust-typescript-swift-and-kotlin-codegen-and-front-end-sdk/3435>\
**Category:** Tech Talk\
**Tags:** ux, treasury-proposal\
**Created:** [July 17, 2023, 12:07pm UTC](https://forum.polkadot.network/t/rust-typescript-swift-and-kotlin-codegen-and-front-end-sdk/3435 "2023-07-17T12:07:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![finsig](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/finsig/32/1806_2.png) [@finsig](https://forum.polkadot.network/u/finsig)\
**Post date:** [July 17, 2023, 12:07pm UTC](https://forum.polkadot.network/t/rust-typescript-swift-and-kotlin-codegen-and-front-end-sdk/3435/1 "2023-07-17T12:07:37Z")

</div>

**Context**

I have a [proposal](https://docs.google.com/document/d/1VL_2eo6bIFkee-V94ms9I8jkDG9ZuMvZhUCodLkNR8g/edit) (see page 28) to build a Swift language SDK for the Apple device platform. Part of the SDK is a runtime metadata Swift codegen tool. I would like to get your (developer) feedback on the codegen tool and my SDK.

In seeking support for my proposal I discovered that [1Password has created a tool for a similar problem](https://twitter.com/Lucretiel/status/1557130558945247233?s=20). However, they are approaching the problem from Rust whereas I am from Swift.

I have a good working knowledge of Swift, but essentially zero working knowledge of Rust. For example: I believe I loosely understand what FFI is. I can kind of grasp what is being said about syn[sp?] AST. I recall reading about Serde when I learned about SCALE. I have no idea what REPL is and this is the first time I have even heard the term.

I am operating on limited/incomplete understanding of Rust and Substrate.

That said, I would like to ask for you help in evaluating the technical merit of my proposal with this new-to-me found knowledge and your expertise.

Here is the YouTube video for the 1Password tool: [1Password Developer Fireside Chat: Typeshare Overview](https://youtu.be/cFeIYmkcamw)

- syn AST ([15:30](https://youtu.be/cFeIYmkcamw?t=930))
- Typeshare tool ([12:48](https://youtu.be/cFeIYmkcamw?t=768))
- TypeScript type generation ([16:16](https://youtu.be/cFeIYmkcamw?t=976))
- Swift type generation ([17:42](https://youtu.be/cFeIYmkcamw?t=1062))
- Kotlin type generation ([18:51](https://youtu.be/cFeIYmkcamw?t=1131))

The GitHub repo for Typeshare can be found [here](https://github.com/1Password/typeshare).

My Swift codegen repo can be found [here](https://github.com/finsig/swift-code-generation-poc).

Please note that my repo is based on a factory design pattern. A more recent refactored version is demonstrated here: [[Completed Work] Feasibility Analysis of Dynamic Type Generation](https://youtu.be/y2U_J9RYeCU)

I am strongly advocating for a native Swift tool and Swift language SDK is to preempt [Apple App Store Review Guidelines Section 4.7](https://developer.apple.com/app-store/review/guidelines/#third-party-software)

Basically, Apple does not allow developers to inject dynamic code that alters functionality. JavaScipt is the exception, but it is restricted to the WebKit browser engine. Cross-platform frameworks such as Flutter, which is based on Google Dart, basically compile down to swift binaries that are then distributed in final app form.

I would like to get feedback from Rust, TypeScript, Swift, and Kotlin developers as this is conceptually relevant to anyone interested in building front-end interfaces for Polkadot.

**Questions:**

- Do you think codegen is a good/bad idea?
- Do you think language specific SDKs are a good/bad approach for Polkadot front-end developers?
- Do you see any technical blindspots that I am missing?
- Would you suggest pursuing a different approach?

I am particularly interested in answers to the questions above but open to all feedback. Thank you for your time!
