Home

Awesome

<picture> <source media="(prefers-color-scheme: dark)" srcset="./Assets/headerdark.gif"> <img src="./Assets/header.gif"> </picture> <p align='center'> <img src='https://github.com/CSolanaM/SkeletonUI/workflows/build/badge.svg'> <img src='https://github.com/CSolanaM/SkeletonUI/workflows/test/badge.svg'> <a href="https://codecov.io/gh/CSolanaM/SkeletonUI"><img src="https://codecov.io/gh/CSolanaM/SkeletonUI/branch/master/graph/badge.svg" /></a> <img src='https://img.shields.io/cocoapods/p/SkeletonUI'> <img src='https://img.shields.io/github/v/tag/CSolanaM/SkeletonUI?color=lightGray&label=version'> <img src='https://img.shields.io/github/license/CSolanaM/SkeletonUI?color=lightGray'> <a href='https://twitter.com/CSolanaM'><img src='https://img.shields.io/badge/twitter-@CSolanaM-lightGray.svg?style=flat&label=contact'></a> </p>

SkeletonUI aims to bring an elegant, declarative syntax to skeleton loading animations. Get rid of loading screens or spinners and start using skeletons to represent final content shapes.

Requirements :gear:

Supported Platforms :iphone:

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 SkeletonUI as a dependency is as easy as adding it to the dependencies value of your Package.swift.

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

CocoaPods

CocoaPods is a centralized dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate SkeletonUI into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'SkeletonUI'

Features :sparkles:

Usage :rocket:

Basic one-liner:

import SkeletonUI
import SwiftUI

struct UsersView: View {
    @State var users = [String]()

    var body: some View {
        Text("Finished requesting \(users.count) users!")
            .skeleton(with: users.isEmpty)
            .onAppear {
                DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
                    self.users = ["John Doe", "Jane Doe", "James Doe", "Judy Doe"]
                }
        }
    }
}

Advanced customization:

import SkeletonUI
import SwiftUI

struct User: Identifiable {
    let id = UUID()
    let name: String
}

struct UsersView: View {
    @State var users = [User]()

    var body: some View {
        SkeletonList(with: users, quantity: 6) { loading, user in
            Text(user?.name)
                .skeleton(with: loading,
                          animation: .pulse(),
                          appearance: .solid(color: .red, background: .blue),
                          shape: .rectangle,
                          lines: 3,
                          scales: [1: 0.5])
        }
        .onAppear {
            DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
                self.users = [User(name: "John Doe"),
                              User(name: "Jane Doe"),
                              User(name: "James Doe"),
                              User(name: "Judy Doe")]
            }
        }
    }
}

Change Log :calendar:

See CHANGELOG.md for details.

Contributing :tada:

See CONTRIBUTING.md for details.

Code of Conduct :speech_balloon:

See CODE_OF_CONDUCT.md for details.

Credits :speak_no_evil:

SkeletonUI is owned and maintained by CSolanaM. You can follow me on Twitter at @CSolanaM or contact me via email for project updates and releases.

License :mortar_board:

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