A customizable UI element written in Swift that animates a label like it's a news ticker.
β Supports UIStoryBoard Interface Builder!
β Animates only if text doesn't fit the screen!
β Supports both left-to-right and right-to-left texts!
To integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift:
.package(url: "https://github.com/yusif-projects/NewsTickerLabel", .upToNextMajor(from: "1.0.0"))Then specify "NewsTickerLabel" as a dependency of the Target in which you wish to use NewsTickerLabel. Here's an example PackageDescription:
// swift-tools-version:5.5
import PackageDescription
let package = Package(
name: "MyPackage",
products: [
.library(name: "MyPackage", targets: ["MyPackage"])
],
dependencies: [
.package(url: "https://github.com/yusif-projects/NewsTickerLabel", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(name: "MyPackage", dependencies: ["NewsTickerLabel"])
]
)- Step 1: Select your project from the project navigator;
- Step 2: Select your project from the project and targets list;
- Step 3: Select package dependencies tab;
- Step 4: Click the
+button;
- Step 5: Type
https://github.com/yusif-projects/NewsTickerLabelin the search bar; - Step 6: Select
NewsTickerLabelfrom the results list; - Step 7: Select
Up to Next Major Versionfrom the dependency rules list; - Step 8: Type
1.0.0in the text field near it; - Step 9: Select your project from the projects list;
- Step 10: Click the
Add Packagebutton;
- Step 11: Select your target from the targets list;
- Step 12: Click the
Add Packagebutton.
- Step 13: Right click (or CTRL click) on the
NewsTickerLabelin the project navigator; - Step 14: Select
Update Package.
You can find an example project in this repository that demonstrates the usage of NewsTickerLabel.
Drag and drop a UIView object from the object library.
In the identity inspector change the class from UIView to NewsTickerLabel.
Customize the parameters in the attributes inspector.
Connect the NewsTickerLabel object to your controller by creating an outlet.
class ViewController: UIViewController {
@IBOutlet weak var newsTickerLabel: NewsTickerLabel!
override func viewDidLoad() {
super.viewDidLoad()
}
}In the viewDidAppear() call the activate() method of your NewsTickerLabel object.
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
newsTickerLabel.activate()
}






