All Projects → mercari → ShimmerView

mercari / ShimmerView

Licence: MIT license
ShimmerView is a collection of APIs to construct Skelton View + Shimmering Effect type loading indicator on UIKit and SwiftUI.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to ShimmerView

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, and across iOS, macOS, tvOS and watchOS.
Stars: ✭ 168 (+136.62%)
Mutual labels:  shimmer, swiftui
Wiggles-iOS
Beautiful Puppy adoption app built to Demonstrate the SwiftUI and MVVM Architecture
Stars: ✭ 174 (+145.07%)
Mutual labels:  swiftui
Harbour
Docker/Portainer management app for iOS
Stars: ✭ 210 (+195.77%)
Mutual labels:  swiftui
SwiftUIMLKitTranslator
SwiftUI MLKit Language Identification & Translator
Stars: ✭ 23 (-67.61%)
Mutual labels:  swiftui
SheeKit
Customize and resize sheets in SwiftUI with SheeKit. Utilise the power of `UISheetPresentationController` and other UIKit features.
Stars: ✭ 56 (-21.13%)
Mutual labels:  swiftui
ConsoleUI
Rasterize SwiftUI views to images from macOS terminal
Stars: ✭ 52 (-26.76%)
Mutual labels:  swiftui
swiftui-app-icon-creator
Create iOS and macOS application icon in Xcode with SwiftUI
Stars: ✭ 58 (-18.31%)
Mutual labels:  swiftui
CoordinatorSwiftUI
A simple project to test the implementation of Coordinator Pattern using SwiftUI.
Stars: ✭ 28 (-60.56%)
Mutual labels:  swiftui
ios
CoThings's iOS application. CoThings is a realtime counter for shared things.
Stars: ✭ 13 (-81.69%)
Mutual labels:  swiftui
Broadcast
🗣 A write-only Twitter client
Stars: ✭ 36 (-49.3%)
Mutual labels:  swiftui
StoreHelper
Implementing and testing In-App Purchases with StoreKit2 and StoreHelper in Xcode 13, Swift 5.5, SwiftUI, iOS 15 and macOS 12.
Stars: ✭ 158 (+122.54%)
Mutual labels:  swiftui
SwiftUI-DesignCode
 SwiftUI-DesignCode is some examples in the process of learning swiftUI 2.0
Stars: ✭ 185 (+160.56%)
Mutual labels:  swiftui
swiftui-mapkit
SwiftUI meets MapKit
Stars: ✭ 17 (-76.06%)
Mutual labels:  swiftui
Xpendi
iOS expense tracker
Stars: ✭ 13 (-81.69%)
Mutual labels:  swiftui
BottomSheet
Access UISheetPresentationController in SwiftUI on iOS 15 using a simple .bottomSheet modifier.
Stars: ✭ 332 (+367.61%)
Mutual labels:  swiftui
delta-client
An open source Minecraft Java Edition client built for speed.
Stars: ✭ 168 (+136.62%)
Mutual labels:  swiftui
Sigma
Sigma is a Figma plugin of automatically generate SwiftUI code from Figma
Stars: ✭ 145 (+104.23%)
Mutual labels:  swiftui
System-Color-Picker
🎨 The macOS color picker as an app with more features
Stars: ✭ 696 (+880.28%)
Mutual labels:  swiftui
NetworkImage
Asynchronous image loading in SwiftUI
Stars: ✭ 39 (-45.07%)
Mutual labels:  swiftui
kindaVim.theapp
Ultimate Vim Mode for macOS
Stars: ✭ 372 (+423.94%)
Mutual labels:  swiftui

ShimmerView Platform iOS11+ License: MIT

ShimmerView is a collection of APIs to construct Skelton View + Shimmering Effect type loading indicator on UIKit and SwiftUI. This framework is inspired by Facebook's Shimmer.

ShimmerViewExample0

Installation

Carthage

github "mercari/ShimmerView"

Cocoapods

pod 'ShimmerView'

Feature

Synchronized Effect

The shimmering effect would be effectively displayed when all the subviews’s effect in the screen is synced and animated together.

Not Synced Synced
NotSynced Synced

ShimmerView calculates its relative coordinate against the sync target and synchronize the shimmering effect with other ShimmerViews.

Customizable

You can customize the appearance of the shimmer effect by using ShimmerViewStyle.

let style = ShimmerViewStyle(
    baseColor: UIColor(red: 239/255, green: 239/255, blue: 239/255, alpha: 1.0),
    highlightColor: UIColor(red: 247/255, green: 247/255, blue: 247/255, alpha: 1.0),
    duration: 1.2,
    interval: 0.4,
    effectSpan: .points(120),
    effectAngle: 0 * CGFloat.pi)

Usage on SwiftUI (iOS 14.0+)

ShimmerView has two related APIs on SwiftUI as below:

  • ShimmerScope
  • ShimmerElement

You can create a custome loading indicator by combining these APIs and other SwiftUI APIs.

struct Placeholder: View {

    @State
    private var isAnimating: Bool = true

    var body: some View {
        ShimmerScope(isAnimating: $isAnimating) {
            HStack(alignment: .top) {
                ShimmerElement(width: 100, height: 100)
                    .cornerRadius(4)
                VStack(alignment: .leading, spacing: 8) {
                    ShimmerElement(height: 12)
                        .cornerRadius(4)
                    ShimmerElement(height: 12)
                        .cornerRadius(4)
                    ShimmerElement(width: 100, height: 12)
                        .cornerRadius(4)
                }
            }
            .padding(.horizontal, 16)
        }
    }
}

ShimmerViewSwiftUI

ShimmerScope

ShimmerScope is a container view to sync the animation timing and style of all the ShimmerElements in its content.

Please note that ShimmerScope uses GeometryReader in its body function and it doesn't fit to the content but expands to the parent view bounds.

ShimmerElement

ShimmerElement is a view to show the shimmering effect animation.

ShimmerElement looks for EnvironmentObject injected by ShimmerScope so please make sure to use it as a sub view of ShimmerScope's content function.

Usage on UIKit

ShimmerView has four related APIs on UIKit as blow:

  • ShimmerView
  • ShimmerSyncTarget
  • ShimmerReplicatorView
  • ShimmerReplicatorViewCell

ShimmerView

ShimmerView is a subclass of UIView that has CAGradientLayer as a sublayer and encapsulates the logic for the shimmering effect animation.

let shimmerView = ShimmerView()
view.addSubview(shimmerView)
shimmerView.startAnimating()

The style of ShimmerView can be customized with ShimmerViewStyle.

let style = ShimmerViewStyle.default
shimmerView.apply(style: style)

ShimmerSyncTarget

ShimmerView can be used as it is, but to make the best effect, create a view or view controller that contains multiple ShimmerViews and specify the container as ShimmerSyncTarget. ShimmerView will calculate its relative origin against the target and adjust the effect automatically.

ShimmerReplicatorView & ShimmerReplicatorViewCell

ShimmerReplicatorView will let you create a list type loading screen with a few lines of code. It replicates the ShimmerReplicatorViewCell provided by the cellProvider closure to fill the bounds of the view.

ShimmerViewList

let replicatorView = ShimmerReplicatorView(
    itemSize: .fixedSize(CGSize(width: 80, height: 80)),
    interitemSpacing: 16,
    lineSpacing: 0,
    horizontalEdgeMode: .within,
    cellProvider: { () -> ShimmerReplicatorViewCell in
        let cell = ShimmerView()
        cell.layer.cornerRadius = 8.0
        cell.layer.masksToBounds = true
        return cell
})
replicatorView.startAnimating()

Contribution

Please read the CLA carefully before submitting your contribution to Mercari. Under any circumstances, by submitting your contribution, you are deemed to accept and agree to be bound by the terms and conditions of the CLA.

https://www.mercari.com/cla/

License

Copyright 2020 Mercari, Inc.

Licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].