LRSpotlight 2.0.0

LRSpotlight 2.0.0

维护者:Lekshmi Raveendranathapanicker.



  • Lekshmi Raveendranathapanicker

Spotlight

适用于 iOS 应用的介绍性框架(受 Gecco 启发,进行重构以使其更简单)

您已经构建了您的应用,添加了许多功能,现在准备好向世界展示它。但假设消费者在导航/使用应用或理解某些功能时遇到困难?在某个时候,发布说明就不适用了。带有箭头和信息的应用截图可能会有所帮助,但真正有帮助的是突出显示应用中的各个部分,并且给予它们一点背景知识。而不会花费他们太多时间。这就是 Spotlight 发光的地方。您只需关注构建那个花哨的新功能,让 Spotlight 处理用户教育部分。在运行时决定要突出显示的内容,而不妥协设计和版本测试功能。查看如何集成 Spotlight 的详细信息,永远不要因为它是困难而非困难而忽略用户教育。

Demo

使用方法

设置 Spotlight 非常简单,只需要几行代码。为视图和工具栏按钮等提供了便利的初始化器。

import LRSpotlight // Cocoapods
OR
import Spotlight // Carthage

class ViewController: UIViewController {

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        startIntro()
    }

    func startIntro() {
        let nodes = [SpotlightNode(text: "Show Spotlight on a Bar button item", target: .barButton(navigationItem.rightBarButtonItem)),
                     SpotlightNode(text: "Show Spotlight on a View", target: .view(nameLabel)),
                     SpotlightNode(text: "Show Spotlight at a point location", target: .point(CGPoint(x: 100, y: 100), radius: 50)),
                     SpotlightNode(text: "Show Spotlight on the first tab bar item", target: .tabBarItem(tabBarController, 0)),
                     SpotlightNode(text: "Show Spotlight over a rectangle", target: .rect(redView.bounds))]

            Spotlight().startIntro(from: self, withNodes: nodes)
    }
}

采用 SpotlightDelegate 协议以在显示每个节点和 spotlight 离开屏幕时获取回调。

public protocol SpotlightDelegate: class {
    func didAdvance(to: Int, of total: Int)
    func didDismiss()
}

安装

CocoaPods

pod 'LRSpotlight'

Carthage

github "lekshmiraveendranath/Spotlight"

配置

// Delay between spotlights (defaults to 3 seconds)
Spotlight.delay = 5.0
// Animation duration for spotlight appearance (Defaults to 0.25 seconds)
Spotlight.animationDuration = 0.1
// Alpha of the Spotlight overlay (defaults to 0.6)
Spotlight.alpha = 0.8
// Background color of the Spotlight view (defaults to black)
Spotlight.backgroundColor = .grey
// Text color inside the info view (defaults to white)
Spotlight.textColor = .green
// Font used inside the info view (defaults to Futura 18pt)
Spotlight.font = UIFont(name: "Lato", size: 18)!
// Display a background for the info text view (defaults to true)
Spotlight.showInfoBackground = true
// The info overlay has a blur effect to make it stand out and be readable across the board (defaults to light)
Spotlight.infoBackgroundEffect = .dark
// Change back and next button titles
Spotlight.backButtonTitle = "atrás"
Spotlight.nextButtonTitle = "siguiente"

功能

  • 易于集成,只需几行代码
  • 基于代码的焦点图,无需为每屏文本布局设置额外的故事板场景
  • 基于计时器的自动跳转(可配置)
  • 视图、工具栏按钮、标签栏项以及使用点或矩形进行焦点图的便捷初始化器
  • 与UI版本测试兼容,因为焦点图在运行时覆盖UI元素显示
  • Swift 4.2
  • 合理的默认设置,可配置