A beginner iOS app built with SwiftUI that introduces core declarative UI concepts including state management, text input, buttons, toggles, and sliders — all in a single composable view.
- Welcome Image — Displays a custom image at the top of the screen
- Text Field Input — User enters their name with a rounded border style
- Show Greeting Button — Tap to reveal a personalized greeting
- Toggle Switch — Alternatively show or hide the greeting using a UISwitch-style toggle
- Font Size Slider — Dynamically adjust the greeting's font size from 10 to 50pt in real time
- Conditional Greeting — Displays "Hello, [name]!" (or "Hello, World!" if no name is entered) with a green border
FirstSwiftUI/
├── ContentView.swift # Main view with all UI and state logic
├── Assets.xcassets/ # Contains the "welcome" image asset
│ └── welcome.imageset/
└── Info.plist
| Variable | Type | Description |
|---|---|---|
name |
String |
Bound to the text field; holds the user's entered name |
showGreeting |
Bool |
Controls visibility of the greeting text; toggled by button and switch |
fontSize |
Double |
Bound to the slider; drives the greeting's font size (10–50pt) |
- Xcode 15 or later
- iOS 16.0+
- Swift 5.9+
- Framework:
SwiftUI
- Clone or download this repository
- Open
FirstSwiftUI.xcodeprojin Xcode - Add a
welcomeimage toAssets.xcassets - Select a simulator or connected device running iOS 16+
- Press Run (
⌘R)
No third-party dependencies or additional setup required.
This project is a hands-on introduction to foundational SwiftUI concepts:
- Using
@Stateto manage local view state reactively - Two-way data binding with
$(binding syntax) forTextField,Toggle, andSlider - Conditional rendering with
ifinside aViewbody - Composing built-in SwiftUI views:
VStack,Image,TextField,Button,Toggle,Slider,Text,Spacer - Applying modifiers like
.font(),.fontWeight(),.padding(), and.border()
Natalie M. Leal — created March 2026 for Texas State University