Coder Social home page Coder Social logo

yusif-projects / newstickerlabel Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 5.62 MB

๐Ÿ“Šย A customizable UI element that animates a label like it's a news ticker.

License: Apache License 2.0

Swift 100.00%
ios newsticker swift ticker uikit crawl crawler slide scrolling-text tickertape

newstickerlabel's Introduction

Follow Star iOS 13.0+ Swift 5.5+ License

NewsTickerLabel

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!

Table of contents

๐Ÿšš Installation

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"])
    ]
)

Or you can use Xcode's built-in tools:

  • 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/NewsTickerLabel in the search bar;
  • Step 6: Select NewsTickerLabel from the results list;
  • Step 7: Select Up to Next Major Version from the dependency rules list;
  • Step 8: Type 1.0.0 in the text field near it;
  • Step 9: Select your project from the projects list;
  • Step 10: Click the Add Package button;

  • Step 11: Select your target from the targets list;
  • Step 12: Click the Add Package button.

How to get the latest update:

  • Step 13: Right click (or CTRL click) on the NewsTickerLabel in the project navigator;
  • Step 14: Select Update Package.

๐Ÿ— Usage

You can find an example project in this repository that demonstrates the usage of NewsTickerLabel.

Example using UIStoryBoard Interface Builder:

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()
}

๐Ÿ“ License

Apache

newstickerlabel's People

Contributors

yusif-projects avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.