Coder Social home page Coder Social logo

darcoachmarks's Introduction

DARCoachMarks

Coach marks library extracted from DAR Applications.

demo

Quick Start

First you have to create a view controller by extending DARCoachMarksViewController. In this controller you need to override some methods to make it work ๐Ÿ™Œ

class CatalogViewController: DARCoachMarksViewController {

    // Number of coaching steps for this controller
    override func numberOfSteps() -> Int {
	return 1
    }
    
    // Coach mark configuration for certain step
    override func stepAt(index: Int) -> DARCoachMarkConfig {
    	let step = DARCoachMarkConfig()
        step.text = "..."  // Text of this mark
        step.highlightFrame = CGRect(...)  // Frame of highlight window in dimmer
        step.highlightCornerRadius = 15  // Corner radius of the highlight window
        step.hintBottom = 100  // Bottom offset for coach mark content (text and buttons)
        step.arrowStartPoint = CGPoint(...)  // Point where the arrrow should start
        step.arrowControlPoint = CGPoint(...)  // Point of control (it uses quad curve path)
        step.arrowEndPoint = CGPoint(...)  // Where the arrow should point
        return step
    }
    
    // Customization overrides:
    // Dimmer background gradient colors
    override var gradientColors: [CGColor] {
    	...
    }
    
    // Accent color
    override var accentColor: UIColor {
    	...
    }
}

After than instantiate your coaching view controller and call present passing it a view that you want to display coach marks on. This method also has an optional steps parameter which is an integer array for steps you'd like to show on this particular call.

Steps that have been displayed will not be displayed again. So for example you have displayed 0 step of a coach marks controller. And on another screen you want to present 0, 1 and 2 steps. Since 0 step has been shown already the coach marking will start from step 1.

If you want to reset shown steps status, you can call resetPresentedStatus method on an instance of your coach marks controller.

...
let cmvc = ExampleCoachMarksViewController()

override func viewDidLoad() {
    super.viewDidLoad()
    ...
    cmvc.present(on: self.view, steps: [0, 1])
    cmvc.resetPresentedStatus()
}

If you want to get notified when user completed the coaching course you can provide a DARCoachingMarksViewControllerDelegate to the controller.

darcoachmarks's People

Contributors

vibze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.