Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Elegant volume indicator as Instagram

License

Notifications You must be signed in to change notification settings

yurii-lysytsia/YFVolumeView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YFVolumeView

Convenient, beautiful and easy to use volume indicator written in Swift 3

YFVolumeView: Elegant Volume View as Instagram

Requirements

  • iOS 8.0+
  • Xcode 8.1+
  • Swift 3.0+

Installation

CocoaPods

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

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build.

To integrate YFVolumeView into your Xcode project using CocoaPods, create Podfile. Run the following command in root folder of your project:

$ pod init

In the Podfile that appears, specify:

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

target '<Your Target Name>' do
	pod 'YFVolumeView'
end

Then, run the following command:

$ pod install

Usage

In your project AppDelegate.swift:

import YFVolumeView

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    ...
    
    func setVolumeIndicator() {
        
        let volumeIndicator = YFVolumeView.current
        volumeIndicator.isActive = true // Make active YFVolumeView and hide native HUD
        volumeIndicator.backgroundColor = .white // Set custom background color
        volumeIndicator.isAnimatingEnable = true // Change animation enable 

//        if let window = self.window {
//            volumeIndicator.setBackgroundColorAsWindowWithRootNavigationBar(window: window)
//            // If AppDelegate.window.rootViewController is UINavigationController, volume indicator color will be as UINavigationController.navigationBar.barTintColor
//        }


    }

    ...

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        ...
        
        self.setVolumeIndicator()
        
        ...

    }

    ...
    
    func applicationDidBecomeActive(_ application: UIApplication) {
        YFVolumeView.current.updateActiveState() // FIX.
    }

...

}