Skip to content

h4yder/VideoLabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VideoLabel

VideoLabel text with blue particles in the text

iOS text with video as text background.

Features

  • Supports local and remote videos.
  • Fully accessible with support for Dynamic Text and Voice Over.
  • text, attributedText, font, url and alignment are configurable.
  • Supports multiple labels with different videos in the same view.

Two video labels with different videos

Installation

Swift Package Manager

Add the package using Xcode by going to:

File > Swift Packages > Add Package Dependency: https://github.com/h4yder/VideoLabel

Manually

Drag VideoLabel.swift into your project, its self-contained.

How to use

Just import the module and add a view.

import VideoLabel

class ViewController: UIViewController {
    func viewDidLoad() {
        super.viewDidLoad()

        let url = Bundle.main.url(forResource: "Video", withExtension: "mov")!
        let label = VideoLabel(text: "Hello World!", url: url)
        label.font = UIFont.systemFont(ofSize: 60)

        view.addSubview(label)
    }
}

Or using an NSAttributedString.

        let attribs: [NSAttributedString.Key: Any] = [
            /* a dictionary of text attributes like kern, font etc.. */
            ]
        let attributedText = NSAttributedString(string: "Hello World!", attributes: attribs)

        let url = Bundle.main.url(forResource: "Video", withExtension: "mov")!
        let label = VideoLabel(attributedText: attributedText, url: url)

More

For more information about how it works, you can read about it here.

About

Bring your titles to life in iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages