Skip to content

Learning Swift, SwiftUI and Xcode following the wonderful tutorials from Paul Hudson over at hackingwithswift.com

Notifications You must be signed in to change notification settings

aaron-22766/Hacking-With-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Hacking With Swift

Learning Swift, SwiftUI and Xcode following the wonderful tutorials from Paul Hudson over at hackingwithswift.com.

Basics of Swift

The first 14 days provide a gentle warm up for your SwiftUI learning as we cover the fundamentals of the Swift programming language. You’ll work through a selection of tutorials every day, and there is some optional extra reading afterwards if you’d like to dig deeper. Checkpoints will challenge you to write your own solution to a problem with all the knowledge you have gathered in the previous tutorials.

  • Day 1: Variables, constants, strings, and numbers
  • Day 2: Booleans, string interpolation, and checkpoint 1
  • Day 3: Arrays, dictionaries, sets, and enums
  • Day 4: Type annotations and checkpoint 2
  • Day 5: If, switch, and the ternary operator
  • Day 6: Loops, summary, and checkpoint 3
  • Day 7: Functions, parameters, and return values
  • Day 8: Default values, throwing functions, and checkpoint 4
  • Day 9: Closures, passing functions into functions, and checkpoint 5
  • Day 10: Structs, computed properties, and property observers
  • Day 11: Access control, static properties and methods, and checkpoint 6
  • Day 12: Classes, inheritance, and checkpoint 7
  • Day 13: Protocols, extensions, and checkpoint 8
  • Day 14: Optionals, nil coalescing, and checkpoint 9
  • Day 15: Swift Review

Projects Overview

Project Desctiption Showcase

Project 1: WeSplit (Day 16-18)

This project is a check-sharing app that calculates how to split a check based on the numbers of people and how much tip you want to leave. The project in itself isn’t complicated, but we’ll be taking it slow so you can see exactly how these fundamentals fit together.

Steps and learnings:
  • Understanding the basic structure of a SwiftUI app
  • Creating a form
  • Adding a navigation bar
  • Modifying program state
  • Binding state to user interface controls
  • Creating views in a loop
  • Reading text from the user with TextField
  • Creating pickers in a form
  • Adding a segmented control for tip percentages
  • Calculating the total per person
  • Hiding the keyboard
Additional work:
  • Custom percentage text field appears if chosen in segmented picker

Challenge Day: Unit Converter (Day 19)

You need to build an app that handles unit conversions: users will select an input unit and an output unit, then enter a value, and see the output of the conversion.

Steps and Learnings:
  • Form, Picker, TextField
Additional work:
  • App lets you choose which unit type to convert
  • Using Unit types and Measurement for conversion

Project 2: GuessTheFlag (Day 20-22)

In this second SwiftUI project we’re going to be building a guessing game that helps users learn some of the many flags of the world. This project is still going to be nice and easy, but gives me chance to introduce you to whole range of new SwiftUI functionality: stacks, buttons, images, alerts, asset catalogs, and more.

Steps and Learnings:
  • Using stacks to arrange views
  • Colors and frames
  • Gradients
  • Buttons and images
  • Showing alert messages
  • Stacking up buttons
  • Showing the player’s score with an alert
  • Styling our flags
  • Upgrading our design
Additional Work:
  • Colors change with appearance
  • Restart button

Project 3: ViewsAndModifiers (Day 23-24)

Today is our first technique project, and we’re focusing on two fundamental components of SwiftUI: views and modifiers. We’ve been using these already, but we’ve kind of glossed over exactly how they work. Well, that ends today: we’ll be going through lots of details about what they are, how they work, and why they work as they do.

Steps and learnings:
  • Why does SwiftUI use structs for views?
  • What is behind the main SwiftUI view?
  • Why modifier order matters
  • Why does SwiftUI use “some View” for its view type?
  • Conditional modifiers
  • Environment modifiers
  • Views as properties
  • View composition
  • Custom modifiers
  • Custom containers
Nothing noteworthy to show today

Milestone 1 & Challenge (Day 25)

Today we'll review what you've learned so far, focusing on these three key points that I'll provide some better insight for:
  • Structs vs classes
  • Working with ForEach
  • Working with bindings
There's also a challenge for you to put that knowledge into practice. It's going to be a Rock, Paper, Scissors Guessing Game, that should work like this:
  • Each turn of the game the app will randomly pick either rock, paper, or scissors.
  • Each turn the app will alternate between prompting the player to win or lose.
  • The player must then tap the correct move to win or lose the game.
  • If they are correct they score a point; otherwise they lose a point.
  • The game ends after 10 questions, at which point their score is shown.

Project 4: BetterRest (Day 26-28)

This SwiftUI project is another forms-based app that will ask the user to enter information and convert that all into an alert. I'm going to introduce you to one of the true power features of iOS development: machine learning (ML) using Apple's CoreML.

Steps and learnings:
  • Entering numbers with Stepper
  • Selecting dates and times with DatePicker
  • Working with dates
  • Training a model with Create ML
  • Connecting SwiftUI to Core ML
Additional work:
  • Coloring individual segments of a form
  • Dark and Light Theme

this list will be expanded as I'm currently working on the projects...

About

Learning Swift, SwiftUI and Xcode following the wonderful tutorials from Paul Hudson over at hackingwithswift.com

Topics

Resources

Stars

Watchers

Forks

Languages