Code Monkey home page Code Monkey logo

rhplaceholder's Introduction

Build Status Version License Platform Language Twitter

RHPlaceholder ๐Ÿ’พ

Because traditional loading view like UIActivityIndicatorView or similar one are no longer so trendy (Facebook or Instagram apps are moving away from these approaches), I decided to create very simple library which will give you oportunity to have Facebook or Instagram 'view loading state' in your great project without big effort ๐Ÿ’ฅ! ๐Ÿ•

Play with it ๐Ÿ˜Ž

Installation

You can install library using Cocoapods:

pod 'RHPlaceholder'

or using Carthage:

add

github "robertherdzik/RHPlaceholder"

to your Cartfile and perform carthage update --platform iOS.

Usage

WOW... it is soo easy to use ๐Ÿ™Š! Base integration with your storyboard VC will take couple minutes ๐Ÿ’ฅ

Base Usage

just create instance const of Placeholder in your ViewController:

private let placeholderMarker = Placeholder() // By default you will have Insta like gradient animation

bear in mind, that you can choose between couple of predefined animations (like e.g. RainbowAnimatorGradient):

private let placeholderMarker = Placeholder(layerAnimator: RainbowAnimatorGradient.self)

... and then just bind up library with your views which needs to be animated:

private func addPlaceholder() {
    let viewElements: [UIView] = [
        name,
        surname,
        age,
        email,
        birthDate
    ]
        
    placeholderMarker.register(viewElements)
}

call addPlaceholder() method in viewDidLoad(). Boom ๐Ÿ˜ฒ library has been associated with your views ๐Ÿ‘

all what left, is to controll showing 'loading state' animation on your views using startAnimation() and remove()

func fetchUserData() {
    placeholderMarker.startAnimation()
    apiManager.fetchUser() { [weak self] user in 
        self?.placeholderMarker.remove()
        // .. rest of the method
    }
}

List of available animatotrs:

(default) InstaLayerAnimatorGradient

BackAndForthLayerAnimatorGradient BlinkAnimator RainbowAnimatorGradient

Customization

You can add your own Animators, by conforming to the LayerAnimating protocol and passing your new Animator as a param to the Placeholder init.

Swift support

Library ver Swift ver Note
0.0.3 4.1 Very early version, API may change
0.0.5 4.2 Very early version, API may change
0.0.6 5.0 Very early version, API may change

Check the Demo project

Please check out the demo project, you can see there how Library has been implemented in details.

Layout Inspiration

Layout inspiration has been taken from one of the Dribbble projects, unfortunately I cannot find now this project anymore, because of that I cannot annotate creator in here ๐Ÿ˜ฆ...

Assets


  • Great ๐Ÿ˜ tab bar icons from:
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY

  • Cool ๐Ÿ˜Ž profile icon from:
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY

rhplaceholder's People

Contributors

albinekcom avatar robertherdzik avatar sergstav avatar subdan avatar

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

rhplaceholder's Issues

Add support for Carthage

Hi there, great job on the library, it is quite neat and useful โ€“ however I ran into a problem when trying to install it via Carthage.

Here's the console output:

$ carthage update --platform iOS
*** Cloning RHPlaceholder
*** Checking out RHPlaceholder at "0.0.1"
*** xcodebuild output can be found in /(โ€ฆ)
*** Skipped building RHPlaceholder due to the error:
Dependency "RHPlaceholder" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/robertherdzik/RHPlaceholder/issues/new

Possibly the scheme isn't marked as shared?, which is a requirement for Carthage to build the framework.

Marking an Xcode project scheme as shared

image
Image from Xcode Documentation

It might be that, but I'm not sure โ€“ For now, I'll just add the dependency manually, but it is possible that other people might run into this issue. Other than that, great job again! ๐Ÿ‘๐Ÿป

add in UItableview

How to add this in custom UITableViewCell cell or collection view cell?

Swift 4.2 update?

Swift 4.2 update?
Some code depreciations need to be updated for swift 4.2 update.

Also does it work with table view with custom cell loaded from .xib?
Its not working for me.

Thank you

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.