Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 3.12 KB

README-0.06.md

File metadata and controls

86 lines (63 loc) · 3.12 KB

CocoaPods Version Status Carthage compatible CocoaPods CocoaPods Platform Swift MIT License

SwiftVideoBackground is an easy to use Swift framework that provides the ability to add a UIView of a video playing in the background to any ViewController. This provides a beautiful UI for login screens, or splash pages, as implemented by Spotify and many others.

  1. Requirements
  2. Integration
  3. Usage
  4. License

Requirements

  • Swift 3+
  • iOS 8+

Integration

CocoaPods

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

For Swift 3:

	pod 'SwiftVideoBackground', '0.06'

Carthage

You can use Carthage to install SwiftVideoBackground by adding it to your Cartfile:

github "dingwilson/SwiftVideoBackground"

Manually

To use this library in your project manually you may:

  1. for Projects, just drag BackgroundVideo.swift to the project tree
  2. for Workspaces, include the whole SwiftVideoBackground.xcodeproj

Usage

Import the framework into the ViewController

import SwiftVideoBackground

Link a UIView within a ViewController within the Storyboard to a BackgroundVideo item, or link it programmatically.

var backgroundVideo : BackgroundVideo!

Use the createBackgroundVideo function, with the name of the video or gif under name, and the file type under type. You can also include an alpha value between 0 and 1 under alpha, to adjust the brightness of the video.

backgroundVideo.createBackgroundVideo(name: "Background", type: "mp4")
backgroundVideo.createBackgroundVideo(name: "Background", type: "mp4", alpha: 0.5)

Note: Make sure you have added a video file to the project, and targeted the project. Also, make sure that you have set the module to SwiftVideoBackground for the BackgroundVideo UIView.

License

SwiftVideoBackground is released under an MIT License. See LICENSE for details.

Copyright © 2016-present Wilson Ding.

Please provide attribution, it is greatly appreciated.