Dominik Hofer
Dominik Hofer

Day 50 #100DaysOfSwiftUI

βœ… Built the Cupcake Corner project (part I)

πŸ”‘ takeaways:
πŸ‘‰ Save data like types as static arrays in class
πŸ‘‰ Use indices property to get the indices of array
πŸ‘‰ Toggle view
πŸ‘‰ Put validations in data not view (computed property)

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 49 #100DaysOfSwiftUI

βœ… Overview of the CupcakeCorner project

πŸ”‘ takeaways:
πŸ‘‰ Codable doesn’t work with @ Published, create custom initializer & encoder
πŸ‘‰ async/await and .task for loading data
πŸ‘‰ AsyncImage for loading images
πŸ‘‰ Validate & disable forms with .disabled()

Dominik Hofer
Dominik Hofer

Day 48 #100DaysOfSwiftUI

βœ… Break day

Nearly 50% done with the course and today was the first day I didn't actually write any code. But I've watched two great videos instead.

If you have any spare time today and are (becoming) a coder, watch this video by @stevewoz πŸ‘‡

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 47 #100DaysOfSwiftUI

βœ… Created the simplest habit tracker ever

This was the first app that I completely built by myself that is actually useful. Impressive, I know πŸ˜‰

Will probably add a few features if I have time the coming days.

Read on for a few behind the scenes πŸ‘‡

Show thread (7 posts)
Dominik Hofer
Dominik Hofer

Uno #006

Tracking expenses is the best way to gain an overview over your finances. But doing it regularly can be tedious.

The solution – an app like @FiveCentsApp by @degisner. It's simple, beautiful and works like a charm.

Entering expenses is as quick as it can get.

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 46 #100DaysOfSwiftUI

βœ… Made my own custom shapes

Doesn't look that beautiful but was a great way to repeat some of the learnings from this section.

Now looking forward to the next bigger challenge tomorrow (already had a look 🀫).

Dominik Hofer
Dominik Hofer

Day 45 #100DaysOfSwiftUI

βœ… Animating shapes

πŸ”‘ takeaways:
πŸ‘‰ .blendMode()
πŸ‘‰ Animate shape changes with animatableData
πŸ‘‰ For multiple props, use AnimatablePair
πŸ‘‰ Only Doubles can be interpolated (not Ints)

Made something even cooler today than yesterday!

Dominik Hofer
Dominik Hofer

Day 44 #100DaysOfSwiftUI

βœ… Drawing more advanced shapes

πŸ”‘ takeaways:
πŸ‘‰ Use stride to create a custom range
πŸ‘‰ CGAffineTransform
πŸ‘‰ FillStyle(eoFill: true) for even-odd filling
πŸ‘‰ Image border with ImagePaint()
πŸ‘‰ Enable Metal with .drawingGroup()

Wanna see something cool?

Dominik Hofer
Dominik Hofer

Day 43 #100DaysOfSwiftUI

βœ… Drawing simple shapes

πŸ”‘ takeaways:
πŸ‘‰ Use Path type to draw shapes
πŸ‘‰ Shapes are built using paths, but more flexible
πŸ‘‰ .strokeBorder() draws on the inside (use InsettableShape protocol)

Here's a struct that draws an arc (great for charts) πŸ‘‡

Dominik Hofer
Dominik Hofer

Day 41 #100DaysOfSwiftUI

βœ… Built the Moonshot project (part II)

πŸ”‘ takeaways:
πŸ‘‰ Use struct initializer to β€œmerge” JSON files
πŸ‘‰ .navigationBarTitleDisplayMode(.inline) on subviews
πŸ‘‰ Force unwrap with !

Also added a little indicator about which crew member was the commander.

Dominik Hofer
Dominik Hofer

Day 40 #100DaysOfSwiftUI

βœ… Built the Moonshot project (part I)

πŸ”‘ takeaways:
πŸ‘‰ Use a separate file to load data into app
πŸ‘‰ Generics are useful for reusability
πŸ‘‰ Use computed properties in your structs
πŸ‘‰ Define colors with an extension
πŸ‘‰ .preferredColorScheme(.dark)

Dominik Hofer
Dominik Hofer

Uno #005

Newsletters cluttering up your inbox?

No problem, just use a dedicated inbox for all the newsletters you don't want to miss. I personally like @stoopinbox. It gives you a special email address and reading app.

What's a newsletter everyone should subscribe to?

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 39 #100DaysOfSwiftUI

βœ… Overview of the Moonshot project

πŸ”‘ takeaways:
πŸ‘‰ .resizeable() to resize images with .scaledToFit/Fill()
πŸ‘‰ GeometryReader is really powerful for resizing
πŸ‘‰ ScrollView
πŸ‘‰ Lazy stacks/grids for lazy loading
πŸ‘‰ NavigationLink to β€œconnect” views

Dominik Hofer
Dominik Hofer

Day 38 #100DaysOfSwiftUI

βœ… Added some additional features on my own

This was a fun project to work on, something I would actually use myself with a few more features πŸ™Œ

I especially like the idea with the picker up top to select the entries that should be shown.

Dominik Hofer
Dominik Hofer

Day 37 #100DaysOfSwiftUI

βœ… Built the iExpense project

πŸ”‘ takeaways:
πŸ‘‰ Organize classes & structs in other files
πŸ‘‰ Use UUID() to create unique ids
πŸ‘‰ Pass data to child views as ObservableObject
πŸ‘‰ Use didSet and initializer to write/read data from class to UserDefaults

Dominik Hofer
Dominik Hofer

Day 36 #100DaysOfSwiftUI

βœ… Overview of the iExpense project

πŸ”‘ takeaways:
πŸ‘‰ Learned about a few property wrappers: StateObject, ObservedObject, Environment, AppStorage
πŸ‘‰ .sheet() modifier to display overlaying view
πŸ‘‰ .onDelete() with ForEach to delete rows

Dominik Hofer
Dominik Hofer

Day 35 (Part II) #100DaysOfSwiftUI

Finished the game and even managed to add a few animations. I'm especially proud of the card flip πŸ™Œ

The code behind it is quite ugly though, will probably come back to it and do a little refactor.

Other suggestions on what I could improve?

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 35 (Part I) #100DaysOfSwiftUI

Here's what I got done so far:
βœ… Basic variable setup
βœ… Entering custom game settings
βœ… Generating Q & A array based on settings
βœ… Start game

Couldn't finish the challenge today, but will continue tomorrow!

Dominik Hofer
Dominik Hofer

Uno #004

An interesting approach when it comes to music: Personalized soundscapes.

@EndelSound provides exactly that: Custom generated sounds you can listen to for focus, exercise or relaxation.

It even considers factors like the current weather or your heart rate!

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 34 #100DaysOfSwiftUI

βœ… Repeating the animation topic by creating some on my own

Todays challenge was to extend the GTF project with my own animations:

  1. The selected flag spins on tap
  2. The other two flags scale down, get desaturated and scaled down

Was a fun one!

Dominik Hofer
Dominik Hofer

Day 33 #100DaysOfSwiftUI (Back at it again)

βœ… Animations pt. II

πŸ”‘ takeaways:
πŸ‘‰ The order in which animations are applied matters, you can also add multiple modifiers
πŸ‘‰ .offset() modifier is like translate in CSS
πŸ‘‰ .transition() modifier for entering/exiting animations

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 32 #100DaysOfSwiftUI (Back at it again)

βœ… Learned about implicit & explicit animations

πŸ”‘ takeaways:
πŸ‘‰ Implicit animations are the easiest ones (.animation() modifier)
πŸ‘‰ Easing functions can use modifiers as well
πŸ‘‰ For explicit animations, wrap with withAnimation

Dominik Hofer
Dominik Hofer

Gonna take a 5-day break from #100DaysOfSwiftUI as I am going on vacation, starting today.

Will be back though ✌️

Dominik Hofer
Dominik Hofer

Uno #003

Let's talk about colors 🎨

ColorBox is a handy tool by @kvyn_ for creating color schemes for your UI designs (Tailwind style).

Takes a bit of getting used to but once you get it, you'll always wanna use it. It even supports export to @figma!

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 31 #100DaysOfSwiftUI

βœ… Added some additional features on my own

The score is calculated by multiplying the number of words with the total number of letters in all answers. The score turns green when you reach 100 or more points (which isn't that easy let me tell you πŸ˜‚)

Dominik Hofer
Dominik Hofer

Day 30 #100DaysOfSwiftUI

βœ… Built the WordScramble project

πŸ”‘ takeaways:
πŸ‘‰ .onSubmit() modifier
πŸ‘‰ withAnimation closure for β€œsmoothly” entering new data
πŸ‘‰ Use .onAppear() modifier to execute code on launch
πŸ‘‰ guard let is very useful with boolean returning functions

Show thread (2 posts)
Dominik Hofer
Dominik Hofer

Day 29 #100DaysOfSwiftUI

βœ… Overview of the WordScramble project

πŸ”‘ takeaways:
πŸ‘‰ The list view is used extensively for displaying data
πŸ‘‰ Resources get put into an app bundle
πŸ‘‰ You can even spellcheck your words with UITextChecker() (although it has a pretty clunky API…)

Dominik Hofer
Dominik Hofer

Day 28 #100DaysOfSwiftUI

βœ… Added some additional features on my own

I actually quite like the result, it's simple but still looks very β€œiOS-like” and nice. It's great to see how comparatively easy it is to create fully functional apps. And the ml part still blows my mind 🀯

Dominik Hofer
Dominik Hofer

Day 27 #100DaysOfSwiftUI

βœ… Built the BetterRest project

πŸ”‘ takeaways:
πŸ‘‰ .toolbar modifier to add an β€œaction” to view
πŸ‘‰ Imported ml models auto generates class
πŸ‘‰ To read a property whenever we want, make it static

Not that beautiful yet, but the ml part is amazing!

Dominik Hofer
Dominik Hofer

Day 26 #100DaysOfSwiftUI

βœ… Overview of the BetterRest project

πŸ”‘ takeaways:
πŸ‘‰ Stepper & Slider are ways to enter numbers
πŸ‘‰ Dates are hard to work with, but Swift provides handy abstractions
πŸ‘‰ You can easily create your own machine learning models with Create ML!

Follow

RSS Feeds