MarqueeLabel
Marquee label for swift
Install / Use
/learn @SabrinaJiang14/MarqueeLabelREADME
MarqueeLabel
MarqueeLabel is very easy to use label. Using CABasicAnimation to implement.
Example
Just run the example project, or clone the repo.
Requirements
- Xcode 12 or above
- iOS 14
- Swift 5
How to use
- Setp 1. In storyboard, drop a UILabel into viewController.

- Setp 2. Select [Show the Identity inspector] in right side panel.
- Setp 3. Change class to [MarqueeLabel] in Custom Class

- Setp 4. Create Referencing Outlets

- Setp 5. Setting text
// Create new label
let label = MarqueeLabel()
// Set up default style
label.style = DefaultStyle()
// Set up the text using default property
lable.text = "Stay Hungry. Stay Foolish. And I have always wished that for myself."
// Update the text color using default property
label.textColor = .blue
// Update the text font using default property
label.font = .preferredFont(forTextStyle: .title1)
- Setp 6. Build and run!

Customize property
// the style must be init with text
var style1 = DefaultStyle()
// need show full text or not
style1.showFullText = true
// set back color
style1.backColor = .clear
// set whether to end the animation with transparency
style1.opacityInTheEnd = true
// set marquee time
style1.duration = 10
New Feature
Implement this protocol if you need tap event, like as:
self.demoLabel.delegate = self
extension ViewController:MarqueeLabelProtocol {
func tap(sender: MarqueeLabel) {
//Do something...
}
}
Licence
Licence MIT
