Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

👋 FirstSwiftUI

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.


✨ Features

  • 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

🗂 Project Structure

FirstSwiftUI/
├── ContentView.swift         # Main view with all UI and state logic
├── Assets.xcassets/          # Contains the "welcome" image asset
│   └── welcome.imageset/
└── Info.plist

🔄 State Variables

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)

🏗 Requirements

  • Xcode 15 or later
  • iOS 16.0+
  • Swift 5.9+
  • Framework: SwiftUI

🚀 Getting Started

  1. Clone or download this repository
  2. Open FirstSwiftUI.xcodeproj in Xcode
  3. Add a welcome image to Assets.xcassets
  4. Select a simulator or connected device running iOS 16+
  5. Press Run (⌘R)

No third-party dependencies or additional setup required.


📖 Concepts Demonstrated

This project is a hands-on introduction to foundational SwiftUI concepts:

  • Using @State to manage local view state reactively
  • Two-way data binding with $ (binding syntax) for TextField, Toggle, and Slider
  • Conditional rendering with if inside a View body
  • Composing built-in SwiftUI views: VStack, Image, TextField, Button, Toggle, Slider, Text, Spacer
  • Applying modifiers like .font(), .fontWeight(), .padding(), and .border()

👩‍💻 Author

Natalie M. Leal — created March 2026 for Texas State University

About

A beginner SwiftUI iOS app introducing core declarative UI concepts — features a name greeting, show/hide toggle, and a live font size slider using @State and data binding.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages