Giter Site home page Giter Site logo

gonzalonunez / skeleton Goto Github PK

View Code? Open in Web Editor NEW
677.0 15.0 77.0 403 KB

✨ An easy way to create sliding CAGradientLayer animations! Works great for creating skeleton screens for loading content.

License: MIT License

Swift 100.00%
loader loading-animations gradients swift ios slide-animation skeleton skeleton-screen

skeleton's Introduction

Skeleton

Skeleton is an easy way to create sliding CAGradientLayer animations! It works great for creating skeleton screens:

👩‍💻 Usage

The entire library comes down to just one public-facing extension:

public extension CAGradientLayer {
  public func slide(to dir: Direction, group: ((CAAnimationGroup) -> Void) = { _ in })
  public func stopSliding()
}

You can check out the example and the documentation for more.

📚 Example

To run the example project, clone the repo, and run pod install from the Example directory first.

🛠 Installation

Skeleton is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Skeleton"

Skeleton is also available through Carthage. Add this to your Cartfile:

github "gonzalonunez/Skeleton" ~> 0.4.0

📄 License

Skeleton is available under the MIT license. See the LICENSE file for more info.

skeleton's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skeleton's Issues

Cannot create circular GradientContainerView

Issue
Library does not support circular shimmer views

Steps to Reproduce
In the example project within SkeletonCell.swift, update the imagePlaceholderView to be a GradientContainerView and update SkeletonCell.xib with the changes. Run the example project to now see a square for the imagePlaceholderView with a shimmer. It seems the imagePlaceholderView.layer.cornerRadius is ignored if imagePlaceholderView is a GradientContainerView.

Image
screen shot 2017-05-21 at 9 56 39 am

Animation stops working

When I put app to the background and then I return to it, animation with gradient stops working.
This happens on example project as well.

-my mistake sorry-

IB: Failed to render and update auto layout status.

Hello. First of all I would like to thank you for this library. I am trying to use this library to build my skeleton loading views, but when I insert a single GradientContainerView, IB breaks,and nothing renders, resulting in all of my VCs being blank in the IB.

The error I get in the build log is the following:

file:///.../LoadingView.xib: error: IB Designables: Failed to render and update auto layout status for UIView (iN0-l3-epB): dlopen(Skeleton.framework, 1): no suitable image found.  Did find:
	Skeleton.framework: required code signature missing for 'Skeleton.framework'

I suppose, as the message says, that if I fix the signature problem then my views will render and there will not be any problems. Is this something I need to solve on my side, or there is a signing problem in the library itself? (Keep in mind that the project builds just fine, it's just that InterfaceBuilder is broken)

Thank you!

Add delay between transitions

First of all thanks for this great project!

Is it possible to add an delay between the transition. For now it seems to be an endless animation and I would like to add a small delay between each gradient.

How can I make the animation like this using Skeleton?

I tried to make the animation like this: https://gph.is/g/amWgbvj (This one created by using library: https://github.com/dvtng/react-loading-skeleton in WebApp).
I tried to chain animation from left to right, but I cant make the same length of gradient shape for all subview. Here is my code:

extension ShimmerExampleCell: SkeletonOwner {
    var gradientLayers: [CAGradientLayer] {
        return [imagePlaceholderView.gradientLayer, titlePlaceholderView.gradientLayer, subtitlePlaceholderView.gradientLayer]
    }
    func slide(to dir: SkeletonDirection, group: ((CAAnimationGroup) -> Void) = { _ in }) {
        imagePlaceholderView.gradientLayer.slide(to: .right) { (animationGroup) in
            animationGroup.beginTime = 0
        }
        
        titlePlaceholderView.gradientLayer.slide(to: .right) { (animationGroup) in
            animationGroup.beginTime = 1.1
            subtitlePlaceholderView.gradientLayer.add(animationGroup, forKey:  CAGradientLayer.kSlidingAnimationKey)
        }
    }
}

And I got: https://gph.is/g/ZPgPlXV

Please help me. Thank you so much!

Add swift version to podspec

Please add swift version to podspec, currently its failing if project is default to another version of swift.
s.swift_version = '4.2'
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.