Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DevLiuSir/LCSlideToUnlock

Repository files navigation

LCSlideToUnlock is a simple slide to unlock iOS UI component.

language swift version xcode version CocoaPods compatible build state GitHub top language https://github.com/DevLiuSir/LCSlideToUnlock/blob/master/LICENSE platform GitHub code size in bytes commits count GitHub last commit GitHub commit activity Github Star GitHub forks GitHub watchers Twitter Follow


Requirements

  • iOS 13+
  • Xcode 11+
  • Swift 5.1+

Screencast

Effect of collection

  • Using enumerations to define LCSlideToUnlock animation types
/// 动画方向
///
/// - horizontal: 水平
/// - vertical: 垂直
/// - diagonalUp: 对角线往上
/// - diagonalDown: 对角线往下
public enum AnimationDirection {
 case horizontal
 case vertical
 case diagonalUp
 case diagonalDown
}

Design

horizontal vertical diagonalUp diagonalDown

Attribute

Attribute name Specific introduction of attributes
textStr LCSlideToUnlock of text
textColor LCSlideToUnlock text color
isEnableAutoreverses Whether to turn on and back animation
shimmerImage Gradient picture (You can only set one with shimmerColors)
shimmerColors The gradient color group (at least two elements, only one with shimmerImage)

Installation

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

Just add the LCSlideToUnlock folder to your project.

or use CocoaPods with Podfile:

pod 'LCSlideToUnlock'

You can use CocoaPods to install LCSlideToUnlock by adding it to your Podfile:

platform :ios, '12.0'
target '<Your Target Name>' do
use_frameworks!
pod 'LCSlideToUnlock'
end

Then, run the following command:

$ pod install

Example:

import UIKit
import LCSlideToUnlock
class ViewController: UIViewController {
 override func viewDidLoad() {
 super.viewDidLoad()
 /******* LCSlideToUnlockView *******/
 let slideToUnlockView = LCSlideToUnlockView(frame: CGRect(x: 0, y: view.bounds.height - 100, width: view.bounds.width, height: 40))
 slideToUnlockView.textStr = "> Slide To Unlock "
 slideToUnlockView.textColor = .black
 slideToUnlockView.shimmerColors = [.white, .white]
 //slideToUnlockView.shimmerImage = UIImage(named: "gradient")
 slideToUnlockView.font = UIFont.systemFont(ofSize: 20)
 slideToUnlockView.animationDirection = .horizontal
 slideToUnlockView.isEnableAutoreverses = false
 slideToUnlockView.showFadeWithDuration(4)
 view.addSubview(slideToUnlockView)
 }
}

About

A simple slide to unlock iOS UI component.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /