dorkhub

playful-swiftui-examples

A collection of SwiftUI examples to use

fabiangruss
Swift26810 forksMITupdated 2 years ago
git clone https://github.com/fabiangruss/playful-swiftui-examples.gitfabiangruss/playful-swiftui-examples

playful-swiftui-examples

A growing collection of pretty SwiftUI code snippets to use in your projects based on code from my projects.

Most examples are focused on having a great UX and adding a little bit of fun for the user.

Feel free to star the repo and follow @fabiangruss on Twitter - many more examples to come :)


Playful, squishy play button

This button toggles between play and pause and is a squishy button that changes its shape when pressed. It uses a combination of animations and symbol effects to achieve a playful look.

previews_play_button.mov

Go to code


Squishy waveform button

This button handles audio playback (provided as Data) and displays an animated waveform when music/voicenotes are playing. Works like this:

  • audio data is divided into chunks
  • each chunk's average amplitude is converted to decibels to create waveform bars
  • these are rendered in SwiftUI
Squishy_Waveform_Button.mp4

Go to code


Highlighted search

This code snippet shows how to highlight the search term in a list of results. It builds a custom HStack with multiple text elements in which the search term is highlighted and contrasted against the rest of the text.

Highlighted search

Go to code


Custom pull to refresh/action

This code snippet shows how to build a custom pull to refresh and attach it to a scroll view. It replaces iOS' default ProgressView by your own view. This view receives the current pull down percentage from 0 to 1 to be used for custom interactions. Inspiration to this refresh view is based on kavsoft.dev

Custom_Pull_to_Refresh.mp4

Go to code


Notification animation

This code snippet shows an animation of a stack of notifications that I used in a notification permission priming screen. Add custom image/avatar paths to make the file runnable.

NotificationAnimation_Preview.mov

Go to code

more like this

VibeSDR

Vibe-coded, but not slop. A mobile-first SDR receiver for iOS, Android & Apple Watch — the live waterfall on your wrist…

C++53

SwiftNES

Just another NES emulator written in Swift

Swift55

search

search projects, people, and tags