neuroswish / playful-swiftui-examples

A collection of SwiftUI examples to use

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 :)


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


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


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


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

About

A collection of SwiftUI examples to use

License:MIT License


Languages

Language:Swift 100.0%