Code Editor
The Code Editor lets you see and edit the actual Swift code of your app. It’s perfect for learning, making quick tweaks, and understanding what the AI creates.The Code Editor is available on Pro and Scale plans. Upgrade your plan to access this feature.
When to Use the Code Editor
Learning Swift
Watch the AI generate code, then explore it in the editor. You’ll learn:- Swift syntax and patterns
- SwiftUI view structure
- How professional apps are organized
- iOS development best practices
Quick Tweaks
Sometimes it’s faster to edit directly:- Changing a color value
- Adjusting spacing
- Fixing a typo in text
- Modifying a simple condition
Debugging
When something isn’t working:- Read the code to understand what’s happening
- Add print statements
- Check for obvious issues
- See exactly what the AI generated
Reading Logs
View runtime output:- Print statements
- Error messages
- App behavior traces
The Code Editor Interface
File Browser
On the left, your project’s file structure:Editor Panel
The main area shows code with:- Syntax highlighting — Colors for keywords, strings, types
- Line numbers — For navigation and reference
- Search — Find text (Cmd+F)
- Auto-indentation — Code stays formatted
Logs Panel
At the bottom (toggle to show):- Build output and errors
- Print statements from your code
- Runtime logs
File Organization
Nativeline organizes code into standard Swift structure:Making Edits
Editing Workflow
- Navigate to the file
- Click to open
- Make changes
- Save (Cmd+S)
- App rebuilds automatically
Example: Changing a Color
Example: Adjusting Padding
Example: Fixing Text
Understanding Swift Code
Views (SwiftUI)
Most UI is in SwiftUI views:struct HomeView: View— Defines a viewvar body: some View— What it displaysVStack,HStack,ZStack— Layout containers- Modifiers like
.font(),.padding()— Styling
Models (Data)
Data structures:State Management
Using@Observable:
Reading Logs
Accessing Logs
- Open Code Editor
- Find the Logs panel/tab
- Run your app
- Watch output appear
Adding Log Statements
Ask the AI:Log Types
See Reading App Logs for more details.
Best Practices
Do
- ✅ Save frequently (Cmd+S)
- ✅ Make small, incremental changes
- ✅ Test after each change
- ✅ Use AI for complex changes
- ✅ Learn from the generated code
Don’t
- ❌ Make massive changes without testing
- ❌ Delete code you don’t understand
- ❌ Ignore compiler errors
- ❌ Forget to save before rebuilding
When Code Changes Don’t Work
If your edits cause build errors:- Check the error in the Logs or chat
- Undo (Cmd+Z) if you can’t fix it
- Ask the AI: “Fix this error: [paste error]”
- Rebuild after fixing
Common Swift Errors
Code Editor vs AI Chat
Combining Both
1
Use AI for the big picture
“Create a settings screen with toggle options”
2
Review the generated code
Open in Code Editor to understand what was created
3
Make small tweaks yourself
Adjust colors, padding, or text directly
4
Use AI for complex changes
“Add an animation when toggles change”
Keyboard Shortcuts
Related
Reading App Logs
Detailed guide to debugging with logs
Keyboard Shortcuts
All available shortcuts