Is there a way to generate Swift/Swift UI code based on user input?

We are looking to develop a product that supports Swift/SwiftUI code generation based on developer input. Like developer should be able to drag and drop UI elements, add API configurations, navigation and generate swift code for view controllers, models, API calls, etc. Developer can use this generated code in Xcode and modify it further as needed. How to approach this and is this possible outside Xcode?

No direct answer to the question. But take care on rules for review: there are strict limits to adding executable code to an app.

2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the app completely viewable and editable by the user.

Is there a way to generate Swift/Swift UI code based on user input?
 
 
Q