Retour au classement

markiv/SwiftUI-Shimmer

Swift

Shimmer is a super-light modifier that adds a shimmering effect to any SwiftUI View, for example, to show that an operation is in progress. It works well on light and dark modes, and across iOS, macOS, tvOS, watchOS and visionOS.

swiftuiswiftiosmacostvoswatchshimmerskeletonvisionos
Croissance des étoiles
Étoiles
1.7k
Forks
83
Croissance hebdomadaire
Issues
4
5001k1.5k
avr. 2021janv. 2023oct. 2024juil. 2026
README

SwiftUI-Shimmer ✨

Shimmer is a super-light modifier that adds a "shimmering" effect to any SwiftUI View, for example, to show that an operation is in progress. It works well on light and dark modes, left-to-right and right-to-left layout directions, and across all Apple platforms: iOS, macOS, tvOS, watchOS and even visionOS! 📱💻🖥️📺⌚️🥽✨

visionOS watchOS

Usage

import SwiftUI
import Shimmer
⋮
⋮
Text("SwiftUI Shimmer").modifier(Shimmer())

or more conveniently

Text("SwiftUI Shimmer").shimmering()

Light Mode Dark Mode

Optional Parameters ⚙️

  • active: Convenience parameter to conditionally enable the effect. Defaults to true.
  • animation: A custom animation. Defaults to Shimmer.defaultAnimation.
  • gradient: A custom gradient. Defaults to Shimmer.defaultGradient.
  • bandSize: The size of the animated mask's "band". Defaults to 0.2 unit points, which corresponds to 20% of the extent of the gradient.

Backward Compatible Parameters

  • active: Convenience parameter to conditionally enable the effect. Defaults to true.
  • duration: The duration of a shimmer cycle in seconds. Default: 1.5.
  • bounce: Whether to bounce (reverse) the animation back and forth. Defaults to false.
  • delay: A delay in seconds. Defaults to 0.

Bounce 3

Custom Animations

You can supply any custom animation:

Text("Loading...")
    .shimmering(
        active: isAnimating,
        animation: .easeInOut(duration: 2).repeatCount(5, autoreverses: false).delay(1)
    )

Gradient Mode

In addition to the original masking mode (which is still the default), Shimmer now supports additional modes to apply the gradient, including as a background or an overlay with a custom blend mode:

Loading

Text("Custom Gradient Mode").bold()
    .font(.largeTitle)
    .shimmering(
        gradient: Gradient(colors: [.clear, .orange, .white, .green, .clear]),
        bandSize: 0.5,
        mode: .overlay()
    )

Animated Skeletons ☠️

Of course, you can combine .shimmering(...) with the .redacted(...) modifier to create interesting animated skeleton views.

Loading

Text("Some text")
    .redacted(reason: .placeholder)
    .shimmering()

Right-To-Left (RTL) Support

The mask and animation now adjusts automatically to the environment's layoutDirection in order to better support different languages and locales.

Installation

Swift Package Manager

Use the package URL or search for the SwiftUI-Shimmer package: https://github.com/markiv/SwiftUI-Shimmer.

For how-to integrate package dependencies refer to Adding Package Dependencies to Your App documentation.

Cocoapods

Add this to your Podfile:

pod 'SwiftUI-Shimmer', :git => 'https://github.com/markiv/SwiftUI-Shimmer.git'

What About UIKit?

For an older, UIKit-based shimmer effect, see UIView-Shimmer.

Dépôts similaires
dkhamsing/open-source-ios-apps

:iphone: Collaborative List of Open-Source iOS Apps

Creative Commons Zero v1.0 Universaliosswift
51.3k6k
jordanbaird/Ice

Powerful menu bar manager for macOS

SwiftGNU General Public License v3.0macosmenubar
icemenubar.app
29k824
NativeScript/NativeScript

⚡ Write Native with TypeScript ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Flutter and you name it compatible.

TypeScriptnpmMIT Licensenativescriptandroid
nativescript.org
25.6k1.7k
CodeEditApp/CodeEdit

📝 CodeEdit App for macOS – Elevate your code editing experience. Open source, free forever.

SwiftMIT Licensemacosapple
codeedit.app
23k1.2k
Whisky-App/Whisky

A modern Wine wrapper for macOS built with SwiftUI

SwiftGNU General Public License v3.0macosswiftui
getwhisky.app
15.2k603
pointfreeco/swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.

SwiftMIT Licensearchitecturecomposition
pointfree.co/collections/composable-architecture
14.8k1.7k
mrkai77/Loop

Window management made elegant.

SwiftGNU General Public License v3.0macosswift
11.2k254
gao-sun/eul

🖥️ macOS status monitoring app written in SwiftUI.

SwiftMIT Licensemacosmonitoring
9.9k373
stonerl/Thaw

Menu bar manager for macOS 26

SwiftGNU General Public License v3.0macosmacos-app
8.9k207
sindresorhus/Gifski

🌈 Convert videos to high-quality GIFs on your Mac

SwiftMIT Licensegifskigif
sindresorhus.com/gifski
8.5k320
XcodesOrg/XcodesApp

The easiest way to install and switch between multiple versions of Xcode - with a mouse click.

SwiftMIT Licensexcodeswift
xcodes.app
8.5k376
ronitsingh10/FineTune

FineTune, a macOS menu bar app for per-app volume control, multi-device output, audio routing, and 10-band EQ. Free and open-source alternative to SoundSource.

SwiftGNU General Public License v3.0audioaudio-utility
8.2k280