Swiftpack.co - Package - serbats/SwiftUISkeleton

SwiftUISkeleton

SwiftUISkeleton gives easy way to animate loading of SwiftUI View.

Requirements :gear:

  • macOS 10.15.
  • Xcode 11.0.
  • Swift 5.0.

Supported Platforms :iphone:

  • iOS 13.0.
  • tvOS 13.0.
  • watchOS 6.0.
  • macOS 10.15.

Installation :computer:

Swift Package Manager

Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Once you have your Swift package set up, adding SwiftUISkeleton as a dependency is as easy as adding it to the dependencies value of your Package.swift.

  dependencies: [
  .package(url: "https://github.com/serbats/SwiftUISkeleton.git", .branch("master"))
  ]

Features :sparkles:

  • ☑ SwiftUI simple, declarative syntax.
  • ☑ Super easy and simple to set up.
  • ☑ All Views are skeletonables.
  • ☑ Fully customizable.
  • ☑ Universal (iPhone, iPad, iPod, Apple TV, Apple Watch, Mac).
  • ☑ SwiftUI ViewModifier power.
  • ☑ Lightweight codebase.

Usage :rocket:

import SwiftUI
import SwiftUISkeleton

struct UsersView: View {
    @State var users: [String] = []
    
    var body: some View {
        VStack {
            Text("Test1")
                .font(.system(size: 15, weight: .bold))
                .skeleton(with: self.users.isEmpty)
            
            SkeletonForEach( self.users, quantity: 2 ) {  user in
                Text(user ?? "Test2")
                .font(.system(size: 55, weight: .bold))
                    .skeleton(with: self.users.isEmpty,
                              shape: RoundedRectangle(cornerRadius: 15),
                              animation: Animation.linear(duration: 1).repeatForever(autoreverses: true),
                              gradient: Gradient(colors: [.blue, .yellow, .red, .blue]))
            }
            
            Text("Test3")
            .skeleton(with: self.users.isEmpty,
                      shape: RoundedRectangle(cornerRadius: 8))
            
            Text("Test4")
            .skeleton(with: self.users.isEmpty,
                      shape: Rectangle(),
                      gradient: Gradient(colors: [.red, .black, .white, .black, .red]))
            
            Button("fade") {
                withAnimation(.easeInOut) {
                    if self.users.isEmpty {
                        self.users = ["John Doe",
                                      "Jane Doe",
                                      "James Doe",
                                      "Judy Doe"]
                    } else {
                        self.users = []
                    }
                }
            }
        }
    }
}

Credits :speak_no_evil:

SwiftUISkeleton is owned and maintained by email.

License :mortar_board:

SwiftUISkeleton is released under the MIT license. See LICENSE for details.

Github

link
Stars: 1

Dependencies

Used By

Total: 0