Skip to content

lixiang1994/Guider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guider

Swift

Features

  • Support for custom area focus.
  • Support for custom view focus.
  • Support for custom mask graphic focus.
  • Support single-page multi-focus display.
  • Support multiple prompts for each focus.

Installation

CocoaPods - Podfile

source 'https://github.com/lixiang1994/Specs'

pod 'Guider'

Carthage - Cartfile

github "lixiang1994/Guider"

Usage

First make sure to import the framework:

import Guider

Here are some usage examples. All devices are also available as simulators:

Each page contains multiple items, each containing a focus and multiple prompts.

Prepare

PageItem

var item = Guider.PageItem(.view(cell))
item = item.set(focus: {
    // focus click action
})
item = item.set(prompt: { (index) in
    // prompts click action
})
// add prompt
item = item.add(prompt: .image(image, .top(0.0)))

Page

Guider.Page(items: [item]) {
    // page click action
}

Start Guider

// The default guide page will be added to the current keyWindow
Guider.Provider.start([page]) {
    // Guided completion
}

Next page

Guider.Provider.next()

Stop Guider

Guider.Provider.stop()

Focus Type

enum Focus {
    // UIView
    case view(UIView)
    case viewInsets(UIView, UIEdgeInsets)
    case viewInsetsCorner(UIView, UIEdgeInsets, cornerRadius: CGFloat)
    case viewInsetsMask(UIView, UIEdgeInsets, UIImage)
    // CGRect
    case rect(CGRect)
    case ellipse(CGRect)
    case mask(CGRect, UIImage)
    case rounded(CGRect, cornerRadius: CGFloat)
    case roundedCorners(CGRect, roundingCorners: UIRectCorner, cornerRadii: CGSize)
    case cirque(center: CGPoint, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, clockwise: Bool)
}

Prompt Type

enum Prompt {
    case image(UIImage, Position)
    case view(UIView, Position)
}

Contributing

If you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue. If you extended the functionality of Guider yourself and want others to use it too, please submit a pull request.

License

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