Skip to content
This repository was archived by the owner on Dec 3, 2020. It is now read-only.

Installation Guide

shiwei93 edited this page Oct 23, 2020 · 8 revisions

Versions

SwiftyPlayer supports from Swift 5.0.

Installation

This is the guide for SwiftyPlayer used in a UIKit app.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate SwiftyPlayer into your project using CocoaPods, specify it to a target in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target 'MyApp' do
  # your other pod
  # ...
  pod 'SwiftyPlayer', '~> 1.0.0'
end

Then, run the following command:

$ pod install 

You should open the {Project}.xcworkspace instead of the {Project}.xcodeproj after you installed anything from CocoaPods.

Carthage

Carthage is a decentralized dependency manager for Cocoa application. To install the Carthage tool, you can use Homebrew.

$ brew update
$ brew install carthage

To integrate SwiftyPlayer into your project using Carthage, specify it in your Cartfile.

github "shiwei93/SwiftyPlayer" ~> 1.0.0

Then, run the following command to build the SwiftyPlayer framework:

$ carthage update SwiftyPlayer --platform iOS

At last, you need to set up your Xcode project manually to add the SwiftyPlayer framework:

  1. On your application targets "General" settings tab, in the "Linked Frameworks and Libraries" section, drag and drop SwiftyPlayer.framework from the Carthage/Build folder on disk.
  2. On your application targets "Build Phases" settings tab, click the "+" icon and choose "New Run Script Phase". Create a Run Script with the following content:
/usr/local/bin/carthage copy-frameworks 
  1. Add the paths to the frameworks you want to use under “Input Files”:
$(SRCROOT)/Carthage/Build/iOS/SwiftyPlayer.framework
  1. Add the paths to the copied frameworks to the “Output Files”:
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SwiftyPlayer.framework

Swift Package Manager

From Xcode 11, you can use Swift Package Manager to add SwiftyPlayer to your project.

  1. Select File > Swift Packages > Add Package Dependency. Enter https://github.com/shiwei93/SwiftyPlayer.git in the "Choose Package Repository" dialog.
  2. In the next page, specify the version resolving rule as "Up to Next Major" with "1.0.0" as its earliest version.
  3. After Xcode checking out the source and resolving the version, you can choose the "SwiftyPlayer" library and add it to your app target.

Next

After installation, you could import SwiftyPlayer to your project by adding this:

import SwiftyPlayer

to the files in which you want to use SwiftyPlayer.

Once you prepared, continue to have a look at the Cheat Sheet to see how to use SwiftyPlayer.

Get Started

Information

Clone this wiki locally