DEV Community

iOSbySSG
iOSbySSG

Posted on

I open-sourced 5 tiny SwiftUI utilities I use in every project

Hey everyone! I've been building iOS apps for a while and kept copying the same utilities across projects, so I finally packaged them up as SPM libraries.

1. swiftui-keyboard-avoider

One-line modifier that moves your view when the keyboard appears.

TextField("Email", text: $email)
  .keyboardAvoider()
Enter fullscreen mode Exit fullscreen mode

2. swiftui-scroll-offset

Track ScrollView offset — great for collapsing headers.

OffsetTrackingScrollView { offset in
  print(offset.y)
} content: {
  // your content
}
Enter fullscreen mode Exit fullscreen mode

3. swiftui-shimmer-loading

Shimmer / skeleton loading effect for any view.

Text("Loading...")
  .shimmer()
Enter fullscreen mode Exit fullscreen mode

4. swiftui-flow-layout

Wrapping HStack for tags and chips. Uses the Layout protocol.

FlowLayout(spacing: 8) {
  ForEach(tags, id: \.self) { Text($0) }
}
Enter fullscreen mode Exit fullscreen mode

5. ios-appstore-review-link

Open App Store review page with one line.

AppStoreReview.open(appID: "123456789")
Enter fullscreen mode Exit fullscreen mode

All MIT licensed, zero dependencies. Would love any feedback or suggestions!

Top comments (0)