Giter VIP home page Giter VIP logo

coachmarker's Introduction

CoachMarker

CoachMarker is a helper to simplify onboarding tutorials

System Requirements

iOS 8.0 or above

Installation

As a CocoaPods Dependency

Swift

Add the following to your Podfile:

pod 'CoachMarker', '~> 1.0'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate CoachMarker into your Xcode project using Carthage, specify it in your Cartfile:

github "vicaren/CoachMarker" "master"

Examples

Using CoachMaker is very simple.

Basic Implementation

Swift

import CoachMarker

class ViewController: UIViewController {
    
    private var coachMarker: CoachMarker?
    
    let markerTexts = [
        "Two driven jocks help fax my big quiz.",
        "Pack my box with five dozen liquor jugs.",
        "The five boxing wizards jump quickly." ]
    
    let markerData = [ CoachMarkerCircleData(coordinate: CGPoint(x: 10, y: 10), radius: 30),
                       CoachMarkerCircleData(coordinate: CGPoint(x: 300, y: 50), radius: 60),
                       CoachMarkerSquareData(coordinate: CGPoint(x: 100, y: 100), size: CGSize(width: 200, height: 50))]
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        showCoachMarker()
    }
    
    func showCoachMarker() {
        coachMarker = CoachMarker(parentView: self.view, dataSource: self)
        coachMarker?.delegate = self
        coachMarker?.showCoachMarker()
    }
}
extension ViewController: CoachMarkerDataSource {
    func numberOfMarkers(in marker: CoachMarker) -> Int {
        return markerTexts.count
    }
    
    func coachMarker(_ coachMarker: CoachMarker, viewForItemAtIndex: Int) -> UIView {
        let tutorial = Tutorial(frame: view.bounds)
        tutorial.delegate = self
        tutorial.infoText.text = markerTexts[viewForItemAtIndex]
        return tutorial
    }
    
    func coachMarker(_ coachMarker: CoachMarker, markerForItemAtIndex: Int) -> CoachMarkerData {
        return markerData[markerForItemAtIndex]
    }
    
}
extension ViewController: CoachMarkerDelegate {
    func coachMarkerDidShow(_ coachMarker: CoachMarker) {
        // TODO: When CoachMarker finished
    }
}
extension ViewController: TutorialDelegate {
    func tutorialDidSkipTapped(tutorial: Tutorial) {
        coachMarker?.skipCoachMarker()
    }
    
    func tutorialDidNextTapped(tutorial: Tutorial) {
        coachMarker?.nextCoachMarker()
    }
}

License

CoachMarker is licensed under the MIT License, please see the LICENSE file.

coachmarker's People

Contributors

vicaren avatar ahmetmobven 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.