Coder Social home page Coder Social logo

superbderrick / summerslider Goto Github PK

View Code? Open in Web Editor NEW
65.0 4.0 6.0 10.5 MB

:lollipop: SummerSlider that can distinguish the parts where the advertisement of the video player comes out

License: MIT License

Swift 95.52% Ruby 2.89% Objective-C 1.59%
ios-ui ios-video-player vast ios-uiview slider youtube-video avplayer avplayerview uislider

summerslider's Introduction

SummerSlider

Swift Swift Swift

CI Status Version License Platform HitCount

SummerSlider

SummerSlider is an iOS Custom Slider library It's available with variety usecases like (typically custome ui slider and video-related apps) Besides the repository introduces various usecase samples with SummerSlider

UseCases

  • Youtube Player UI scenario
    It s s some parts for advertisement separator sections during entire video duration

  • IMA SDK (VAST) with AVPLAYER

If you used Google IMA SDK with AVPLAYER , the summer slider is a very useful and suitable vast sample code was intergrated and explained how to use for some vase usecases such as midrole and prerole cases

Demo

Basic

demo1

Usecase(IMA SDK)

demo2

Requirements

  • Swift 3,4.0,5.0
  • iOS 8.0+
  • Xcode 8

How to install

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

Swift 3.0

pod 'SummerSlider', '~>0.2.0'

Swift 4.0

pod 'SummerSlider', '~>0.3.0'

Swift 5.0

pod 'SummerSlider', '~>0.4.0'

Classic and ancient way

Copy into your project the following files: SummerSlider.swift , Constants.swift, HorizontalSlider.swift,Slider.swift,SliderDrawingProtocol.swift,SliderFactory.swift, SummerSliderTypes.swift,VerticalSlider.swift,

How to use it?

First way (User Interface):

Add an UISlider outlet to your view using the User Interface and set SummerSlider as the custom class. Mostly the exposed properties are marked with @IBInspectable, so you can customize them in storyboard's attributes inspector and preview it directly.

Link it with the outlet property if you want to access its properties:

@IBOutlet weak var sampleSlider: SummerSlider!

Simply customize it! (take a look at -Customization- section)

var sampleArray = Array<Float>()
sampleArray = [0,12,23,34,45,56,77,99]
sampleSlider.selectedBarColor = UIColor.white
sampleSlider.unselectedBarColor = UIColor.black
sampleSlider.markColor = UIColor.orange
sampleSlider.markWidth = 2.0
sampleSlider.markPositions = sampleArray

Second way (Using code) - Preferred

It is really easy to set it! Firstly, import SummerSlider.

import SummerSlider

Instantiate and customize it (again, take a look at -Customization- section). Finally add it to the desired view as usual:


let testRect1 = CGRect(x:30 ,y:70 , width:300 ,height:30)
var marksArray1 = Array<Float>()
marksArray1 = [0,10,20,30,40,50,60,70,80,90,100]
secondSlider = SummerSlider(frame: testRect1)
secondSlider.selectedBarColor = UIColor.blue
secondSlider.unselectedBarColor = UIColor.red
secondSlider.markColor = UIColor.yellow
secondSlider.markWidth = 2.0
secondSlider.markPositions = marksArray1
self.view.addSubview(secondSlider)

Setting the marks

You can set the marks using a percentage system from 0 to 100 (Percent). Set all the marks in the markPositions array property:

summerSlider.markPositions = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

Customization

Here you can see a bunch of parameters that you can change:

Marks

  • markColor : UIColor - Customize the color of the marks.
  • markWidth: Float - Customize the width of the marks.
  • markPositions: [Float] - Set in a percentage system from 0 to 100 where the marks should be placed.

Bar colors

  • selectedBarColor: UIColor - Customize the color of the selected side of the slider.
  • unselectedBarColor: UIColor - Customize the color of the unselected side of the slider.

Author

SuperbDerrick, [email protected]

References

Please Let me know pull request or if you want to use this library in your application.

License

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

summerslider's People

Contributors

superbderrick 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

Watchers

 avatar  avatar  avatar  avatar

summerslider's Issues

Gradient colors

Hello!
Is there a way to modify the SummerSlider so you can make the slider colors gradient? Finding it tricky to use CAGradientLayer in conjunction with your code.

Your Summer Slider has been perfect for my project needs ๐Ÿ˜„, just finding it difficult to make the colors gradient.

Example:

ReadingStage_Bar

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.