├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.md ├── Sample ├── VolumeBarSample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── VolumeBarSample │ ├── AppDelegate.swift │ ├── Resources │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon@2x.png │ │ │ └── Icon@3x.png │ │ └── Contents.json │ ├── Info.plist │ └── LaunchScreen.storyboard │ ├── ViewController.swift │ ├── VolumeBarMock.swift │ └── VolumeBarSampleButton.swift ├── Sources ├── Internal │ ├── SystemVolumeManager.swift │ ├── VolumeBarStackView.swift │ └── VolumeBarWindow.swift ├── VolumeBar.swift ├── VolumeBarAnimation+Presets.swift ├── VolumeBarAnimation.swift ├── VolumeBarStyle+Presets.swift └── VolumeBarStyle.swift ├── VolumeBar.gif ├── VolumeBar.podspec ├── VolumeBar ├── Info.plist └── VolumeBar.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ └── xcschemes │ └── VolumeBar.xcscheme ├── build_docs.sh └── docs ├── Classes.html ├── Classes ├── VolumeBar.html └── VolumeBar │ └── AnimationStyle.html ├── Extensions.html ├── Extensions └── UIDevice.html ├── Protocols.html ├── Protocols └── VolumeDelegate.html ├── Structs.html ├── Structs ├── VolumeBarAnimation.html └── VolumeBarStyle.html ├── Typealiases.html ├── badge.svg ├── css ├── highlight.css └── jazzy.css ├── docsets ├── VolumeBar.docset │ └── Contents │ │ ├── Info.plist │ │ └── Resources │ │ ├── Documents │ │ ├── Classes.html │ │ ├── Classes │ │ │ ├── VolumeBar.html │ │ │ └── VolumeBar │ │ │ │ └── AnimationStyle.html │ │ ├── Extensions.html │ │ ├── Extensions │ │ │ └── UIDevice.html │ │ ├── Protocols.html │ │ ├── Protocols │ │ │ └── VolumeDelegate.html │ │ ├── Structs.html │ │ ├── Structs │ │ │ ├── VolumeBarAnimation.html │ │ │ └── VolumeBarStyle.html │ │ ├── Typealiases.html │ │ ├── badge.svg │ │ ├── css │ │ │ ├── highlight.css │ │ │ └── jazzy.css │ │ ├── img │ │ │ ├── carat.png │ │ │ ├── dash.png │ │ │ └── gh.png │ │ ├── index.html │ │ ├── js │ │ │ ├── jazzy.js │ │ │ └── jquery.min.js │ │ ├── search.json │ │ └── undocumented.json │ │ └── docSet.dsidx ├── VolumeBar.tgz └── VolumeBar.xml ├── img ├── carat.png ├── dash.png └── gh.png ├── index.html ├── js ├── jazzy.js └── jquery.min.js ├── search.json └── undocumented.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | .DS_Store 6 | 7 | ## Build generated 8 | build/ 9 | DerivedData 10 | 11 | ## Various settings 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | 22 | ## Other 23 | *.xccheckout 24 | *.moved-aside 25 | *.xcuserstate 26 | *.xcscmblueprint 27 | 28 | ## Obj-C/Swift specific 29 | *.hmap 30 | *.ipa 31 | 32 | ## Playgrounds 33 | timeline.xctimeline 34 | playground.xcworkspace 35 | 36 | # Swift Package Manager 37 | # 38 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 39 | # Packages/ 40 | .build/ 41 | 42 | # CocoaPods 43 | # 44 | # We recommend against adding the Pods directory to your .gitignore. However 45 | # you should judge for yourself, the pros and cons are mentioned at: 46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 47 | # 48 | # Pods/ 49 | 50 | # Carthage 51 | # 52 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 53 | # Carthage/Checkouts 54 | 55 | Carthage/Build 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 60 | # screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 63 | 64 | fastlane/report.xml 65 | fastlane/screenshots -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode10.2 3 | env: 4 | global: 5 | - LC_CTYPE=en_US.UTF-8 6 | - LANG=en_US.UTF-8 7 | before_install: 8 | - bundle install 9 | script: 10 | - xcodebuild -project VolumeBar/VolumeBar.xcodeproj -scheme VolumeBar -sdk iphonesimulator12.2 build analyze 11 | - bundle exec pod lib lint --verbose 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ### One issue or bug per Pull Request 2 | 3 | Keep your Pull Requests small. Small PRs are easier to reason about which makes them significantly more likely to get merged. 4 | 5 | ### Issues before features 6 | 7 | If you want to add a feature, please file an [Issue](issues) first. An Issue gives us the opportunity to discuss the requirements and implications of a feature with you before you start writing code. 8 | 9 | ### Forwards compatibility 10 | 11 | Please do not write new code using deprecated APIs. -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' do 2 | gem 'cocoapods', '~> 1.6.1' 3 | gem 'jazzy', '~> 0.9.3' 4 | end -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.0) 5 | activesupport (4.2.11.1) 6 | i18n (~> 0.7) 7 | minitest (~> 5.1) 8 | thread_safe (~> 0.3, >= 0.3.4) 9 | tzinfo (~> 1.1) 10 | atomos (0.1.3) 11 | claide (1.0.2) 12 | cocoapods (1.6.1) 13 | activesupport (>= 4.0.2, < 5) 14 | claide (>= 1.0.2, < 2.0) 15 | cocoapods-core (= 1.6.1) 16 | cocoapods-deintegrate (>= 1.0.2, < 2.0) 17 | cocoapods-downloader (>= 1.2.2, < 2.0) 18 | cocoapods-plugins (>= 1.0.0, < 2.0) 19 | cocoapods-search (>= 1.0.0, < 2.0) 20 | cocoapods-stats (>= 1.0.0, < 2.0) 21 | cocoapods-trunk (>= 1.3.1, < 2.0) 22 | cocoapods-try (>= 1.1.0, < 2.0) 23 | colored2 (~> 3.1) 24 | escape (~> 0.0.4) 25 | fourflusher (>= 2.2.0, < 3.0) 26 | gh_inspector (~> 1.0) 27 | molinillo (~> 0.6.6) 28 | nap (~> 1.0) 29 | ruby-macho (~> 1.4) 30 | xcodeproj (>= 1.8.1, < 2.0) 31 | cocoapods-core (1.6.1) 32 | activesupport (>= 4.0.2, < 6) 33 | fuzzy_match (~> 2.0.4) 34 | nap (~> 1.0) 35 | cocoapods-deintegrate (1.0.4) 36 | cocoapods-downloader (1.2.2) 37 | cocoapods-plugins (1.0.0) 38 | nap 39 | cocoapods-search (1.0.0) 40 | cocoapods-stats (1.1.0) 41 | cocoapods-trunk (1.3.1) 42 | nap (>= 0.8, < 2.0) 43 | netrc (~> 0.11) 44 | cocoapods-try (1.1.0) 45 | colored2 (3.1.2) 46 | concurrent-ruby (1.1.5) 47 | escape (0.0.4) 48 | ffi (1.9.25) 49 | fourflusher (2.2.0) 50 | fuzzy_match (2.0.4) 51 | gh_inspector (1.1.3) 52 | i18n (0.9.5) 53 | concurrent-ruby (~> 1.0) 54 | jazzy (0.9.3) 55 | cocoapods (~> 1.0) 56 | mustache (~> 0.99) 57 | open4 58 | redcarpet (~> 3.2) 59 | rouge (>= 2.0.6, < 4.0) 60 | sass (~> 3.4) 61 | sqlite3 (~> 1.3) 62 | xcinvoke (~> 0.3.0) 63 | liferaft (0.0.6) 64 | minitest (5.11.3) 65 | molinillo (0.6.6) 66 | mustache (0.99.8) 67 | nanaimo (0.2.6) 68 | nap (1.1.0) 69 | netrc (0.11.0) 70 | open4 (1.3.4) 71 | rb-fsevent (0.10.3) 72 | rb-inotify (0.9.10) 73 | ffi (>= 0.5.0, < 2) 74 | redcarpet (3.4.0) 75 | rouge (3.3.0) 76 | ruby-macho (1.4.0) 77 | sass (3.6.0) 78 | sass-listen (~> 4.0.0) 79 | sass-listen (4.0.0) 80 | rb-fsevent (~> 0.9, >= 0.9.4) 81 | rb-inotify (~> 0.9, >= 0.9.7) 82 | sqlite3 (1.3.13) 83 | thread_safe (0.3.6) 84 | tzinfo (1.2.5) 85 | thread_safe (~> 0.1) 86 | xcinvoke (0.3.0) 87 | liferaft (~> 0.0.6) 88 | xcodeproj (1.8.2) 89 | CFPropertyList (>= 2.3.3, < 4.0) 90 | atomos (~> 0.1.3) 91 | claide (>= 1.0.2, < 2.0) 92 | colored2 (~> 3.1) 93 | nanaimo (~> 0.2.6) 94 | 95 | PLATFORMS 96 | ruby 97 | 98 | DEPENDENCIES 99 | cocoapods (~> 1.6.1)! 100 | jazzy (~> 0.9.3)! 101 | 102 | BUNDLED WITH 103 | 1.16.2 104 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-Present Sachin Patel (http://gizmosachin.com/) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Deprecated 2 | 3 | VolumeBar is now deprecated. iOS [now includes](https://www.macrumors.com/2019/06/03/apple-ios-13-volume-indicator/) a non-intrusive volume indicator, so apps should stop using VolumeBar. 4 | 5 | ![VolumeBar](https://github.com/gizmosachin/VolumeBar/raw/master/VolumeBar.gif) 6 | 7 | ## VolumeBar 8 | 9 | VolumeBar is a [Swift](https://developer.apple.com/swift/) volume indicator that doesn't obstruct content on screen. 10 | 11 | [![Build Status](https://travis-ci.org/gizmosachin/VolumeBar.svg?branch=master)](https://travis-ci.org/gizmosachin/VolumeBar) ![Pod Version](https://img.shields.io/cocoapods/v/VolumeBar.svg) [![Swift Version](https://img.shields.io/badge/language-swift%205.0-brightgreen.svg)](https://developer.apple.com/swift) [![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](LICENSE) 12 | 13 | | | Features | 14 | | :----------: | :--------------------------------------- | 15 | | :no_good: | Hides system volume HUD automatically | 16 | | :art: | Customizable appearance with presets | 17 | | :boom: | Support for custom animations | 18 | | :iphone: | Works with iPhone X | 19 | | :books: | Fully [documented](https://gizmosachin.github.io/VolumeBar) | 20 | | :baby_chick: | [Swift 5](https://developer.apple.com/swift/) | 21 | 22 | 23 | ## Usage 24 | 25 | It's super easy to add VolumeBar to your app: 26 | 27 | ```swift 28 | let volumeBar = VolumeBar.shared 29 | volumeBar.style = .likeInstagram 30 | volumeBar.start() 31 | ``` 32 | 33 | Customize appearance attributes (see [`VolumeBarStyle`](https://gizmosachin.github.io/VolumeBar/Structs/VolumeBarStyle.html)): 34 | ```swift 35 | let volumeBar = VolumeBar.shared 36 | var customStyle = VolumeBarStyle.likeInstagram 37 | customStyle.trackTintColor = .white 38 | customStyle.trackTintColor = .darkGray 39 | customStyle.backgroundColor = .black 40 | volumeBar.style = customStyle 41 | ``` 42 | 43 | Or even use custom animations (see [`VolumeBarAnimation`](https://gizmosachin.github.io/VolumeBar/Structs/VolumeBarAnimation.html)): 44 | ```swift 45 | let volumeBar = VolumeBar.shared 46 | let fadeInAnimation = VolumeBarAnimation({ (view, completion) in 47 | view.alpha = 0 48 | UIView.animate(withDuration: 0.2, animations: { 49 | view.alpha = 1 50 | }, completion: completion) 51 | }) 52 | volumeBar.showAnimation = fadeInAnimation 53 | ``` 54 | 55 | ### Background Audio 56 | If your app doesn't do custom audio handling, adding VolumeBar will make background music (like Spotify) pause when your app is opened. 57 | 58 | Prevent this by adding the following wherever you call `VolumeBar.shared.start()`: 59 | 60 | ```swift 61 | try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient) 62 | ``` 63 | 64 | ### VolumeBar 65 | 66 | VolumeBar is fully documented [here](https://gizmosachin.github.io/VolumeBar/). 67 | 68 | ## Installation 69 | 70 | ### [CocoaPods](https://cocoapods.org/) 71 | 72 | ```ruby 73 | source 'https://github.com/CocoaPods/Specs.git' 74 | use_frameworks! 75 | 76 | pod 'VolumeBar', '~> 3.1' 77 | ``` 78 | 79 | ### [Carthage](https://github.com/Carthage/Carthage) 80 | 81 | ```ogdl 82 | github "gizmosachin/VolumeBar" "master" 83 | ``` 84 | 85 | ## Sample 86 | Please see the `Sample` directory for a basic iOS project that uses `VolumeBar`. 87 | 88 | ## Contributing 89 | VolumeBar is a community - contributions and discussions are welcome! 90 | 91 | Please read the [contributing guidelines](CONTRIBUTING.md) prior to submitting a Pull Request. 92 | 93 | ## License 94 | 95 | VolumeBar is available under the MIT license, see the [LICENSE](https://github.com/gizmosachin/VolumeBar/blob/master/LICENSE) file for more information. 96 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // VolumeBar 4 | // 5 | // Created by Sachin on 3/4/16. 6 | // Copyright © 2016 Sachin Patel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { 17 | window = UIWindow(frame: UIScreen.main.bounds) 18 | window?.backgroundColor = UIColor.white 19 | 20 | window?.rootViewController = ViewController() 21 | 22 | window?.makeKeyAndVisible() 23 | return true 24 | } 25 | 26 | func applicationWillResignActive(_ application: UIApplication) { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | func applicationDidEnterBackground(_ application: UIApplication) { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | func applicationWillEnterForeground(_ application: UIApplication) { 37 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | func applicationDidBecomeActive(_ application: UIApplication) { 41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 42 | } 43 | 44 | func applicationWillTerminate(_ application: UIApplication) { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "Icon@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "idiom" : "ios-marketing", 47 | "size" : "1024x1024", 48 | "scale" : "1x" 49 | } 50 | ], 51 | "info" : { 52 | "version" : 1, 53 | "author" : "xcode" 54 | } 55 | } -------------------------------------------------------------------------------- /Sample/VolumeBarSample/Resources/Assets.xcassets/AppIcon.appiconset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/Sample/VolumeBarSample/Resources/Assets.xcassets/AppIcon.appiconset/Icon@2x.png -------------------------------------------------------------------------------- /Sample/VolumeBarSample/Resources/Assets.xcassets/AppIcon.appiconset/Icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/Sample/VolumeBarSample/Resources/Assets.xcassets/AppIcon.appiconset/Icon@3x.png -------------------------------------------------------------------------------- /Sample/VolumeBarSample/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Sample/VolumeBarSample/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | VolumeBar 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarStyle 34 | UIStatusBarStyleDefault 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // VolumeBar 4 | // 5 | // Created by Sachin on 3/5/16. 6 | // Copyright © 2016 Sachin Patel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AudioToolbox 11 | import MediaPlayer 12 | 13 | class ViewController: UIViewController, UIScrollViewDelegate { 14 | let label: UILabel 15 | let stackView: UIStackView 16 | 17 | let mock: VolumeBarMock 18 | 19 | func createLooperButton() -> UIButton { 20 | return VolumeBarSampleButton("Start Automatic Preview") { (button: UIButton) in 21 | let started = self.mock.automaticPreviewIsRunning 22 | if started { 23 | self.mock.stopAutomaticPreview() 24 | button.setTitle("Start Automatic Preview", for: .normal) 25 | } else { 26 | self.mock.startAutomaticPreview() 27 | button.setTitle("Stop Automatic Preview", for: .normal) 28 | } 29 | } 30 | } 31 | 32 | let likeInstagramButton: UIButton = { 33 | return VolumeBarSampleButton("Use Instagram Style") { _ in 34 | VolumeBar.shared.style = .likeInstagram 35 | } 36 | }() 37 | 38 | let likeSnapchatButton: UIButton = { 39 | return VolumeBarSampleButton("Use Snapchat Style") { _ in 40 | VolumeBar.shared.style = .likeSnapchat 41 | } 42 | }() 43 | 44 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 45 | label = UILabel() 46 | label.font = .systemFont(ofSize: 36, weight: .medium) 47 | label.text = "VolumeBar" 48 | label.textAlignment = .center 49 | 50 | stackView = UIStackView() 51 | stackView.axis = .vertical 52 | stackView.distribution = .fillEqually 53 | stackView.spacing = 20 54 | 55 | mock = VolumeBarMock() 56 | 57 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 58 | } 59 | 60 | required init?(coder aDecoder: NSCoder) { 61 | fatalError("init(coder:) has not been implemented") 62 | } 63 | 64 | override func viewDidLoad() { 65 | super.viewDidLoad() 66 | 67 | // Add the stack view 68 | view.addSubview(stackView) 69 | 70 | // Add buttons 71 | stackView.addArrangedSubview(label) 72 | stackView.addArrangedSubview(createLooperButton()) 73 | stackView.addArrangedSubview(likeInstagramButton) 74 | stackView.addArrangedSubview(likeSnapchatButton) 75 | 76 | // Extra spacing after header label 77 | if #available(iOS 11.0, *) { 78 | stackView.setCustomSpacing(40, after: label) 79 | } 80 | 81 | // Add constraints 82 | stackView.translatesAutoresizingMaskIntoConstraints = false 83 | NSLayoutConstraint.activate([ 84 | stackView.centerXAnchor.constraint(equalTo: view.centerXAnchor), 85 | stackView.centerYAnchor.constraint(equalTo: view.centerYAnchor), 86 | stackView.widthAnchor.constraint(equalToConstant: 280), 87 | stackView.heightAnchor.constraint(equalToConstant: 300) 88 | ]) 89 | } 90 | 91 | override func viewWillAppear(_ animated: Bool) { 92 | super.viewWillAppear(animated) 93 | 94 | // Don't interrupt user audio 95 | try! AVAudioSession.sharedInstance().setCategory(.ambient, mode: .default, options: []) 96 | 97 | // Initial style 98 | VolumeBar.shared.style = .likeInstagram 99 | VolumeBar.shared.start() 100 | } 101 | } 102 | 103 | // Helper function inserted by Swift 4.2 migrator. 104 | fileprivate func convertFromAVAudioSessionCategory(_ input: AVAudioSession.Category) -> String { 105 | return input.rawValue 106 | } 107 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample/VolumeBarMock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VolumeBarSampleLooper.swift 3 | // VolumeBarSample 4 | // 5 | // Created by Sachin on 2/22/18. 6 | // Copyright © 2018 Sachin Patel. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class VolumeBarMock { 12 | public var automaticPreviewIsRunning: Bool { 13 | return timer != nil 14 | } 15 | 16 | private var timer: Timer? 17 | private var lastVolume: Float = 0.5 18 | private var increasing: Bool = true 19 | 20 | func startAutomaticPreview() { 21 | self.timer = Timer.scheduledTimer(timeInterval: 0.5, target: self, selector: #selector(VolumeBarMock.toggleVolume), userInfo: nil, repeats: true) 22 | } 23 | 24 | func stopAutomaticPreview() { 25 | self.timer?.invalidate() 26 | self.timer = nil 27 | } 28 | 29 | @objc func toggleVolume() { 30 | if lastVolume >= 1 { 31 | increasing = false 32 | } else if lastVolume <= 0 { 33 | increasing = true 34 | } 35 | 36 | let changeAmount: Float = 1.0 / 16.0 37 | let change: Float = increasing ? changeAmount : -changeAmount 38 | let newVolume = max(min(lastVolume + change, 1), 0) 39 | lastVolume = newVolume 40 | 41 | // Note: You can't (and shouldn't) access the `systemVolumeManager` in production 42 | // because it's `internal` to the VolumeBar module. You can, however, use 43 | // `@testable import VolumeBar` to access and mock it like this in tests. 44 | VolumeBar.shared.systemVolumeManager?.volumeChanged(to: newVolume) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Sample/VolumeBarSample/VolumeBarSampleButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VolumeBarSampleButton.swift 3 | // VolumeBarSample 4 | // 5 | // Created by Sachin on 2/22/18. 6 | // Copyright © 2018 Sachin Patel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | typealias VolumeBarSampleButtonHandler = ((UIButton) -> Void) 12 | 13 | class VolumeBarSampleButton: UIButton { 14 | private var handler: VolumeBarSampleButtonHandler? 15 | 16 | convenience init(_ title: String, _ handler: @escaping VolumeBarSampleButtonHandler) { 17 | self.init(frame: .zero) 18 | 19 | self.handler = handler 20 | 21 | layer.masksToBounds = true 22 | layer.cornerRadius = 20 23 | 24 | let blue = #colorLiteral(red: 0.008045921102, green: 0.4740749598, blue: 0.9883448482, alpha: 1) 25 | layer.borderColor = blue.cgColor 26 | layer.borderWidth = 1 27 | 28 | setTitle(title, for: .normal) 29 | setTitleColor(blue, for: .normal) 30 | titleLabel?.textAlignment = .center 31 | 32 | setBackgroundImage(blue.withAlphaComponent(0.1).tileableImage, for: .highlighted) 33 | 34 | addTarget(self, action: #selector(VolumeBarSampleButton.performHandler), for: .touchUpInside) 35 | } 36 | 37 | @objc func performHandler() { 38 | handler?(self) 39 | } 40 | } 41 | 42 | private extension UIColor { 43 | var tileableImage: UIImage { 44 | UIGraphicsBeginImageContext(CGSize(width: 1, height: 1)) 45 | let context = UIGraphicsGetCurrentContext()! 46 | context.setFillColor(cgColor) 47 | context.fill(CGRect(x: 0, y: 0, width: 1, height: 1)) 48 | let image = UIGraphicsGetImageFromCurrentImageContext()! 49 | UIGraphicsEndImageContext() 50 | return image 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Sources/Internal/SystemVolumeManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SystemVolumeManager.swift 3 | // 4 | // Copyright (c) 2016-Present Sachin Patel (http://gizmosachin.com) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import UIKit 26 | import AVFoundation 27 | 28 | @objc internal protocol SystemVolumeObserver { 29 | func volumeChanged(to volume: Float) 30 | } 31 | 32 | internal final class SystemVolumeManager: NSObject { 33 | fileprivate let observers: NSHashTable 34 | fileprivate var isObservingSystemVolumeChanges: Bool = false 35 | 36 | internal override init() { 37 | observers = NSHashTable.weakObjects() 38 | 39 | super.init() 40 | 41 | startObservingSystemVolumeChanges() 42 | startObservingApplicationStateChanges() 43 | } 44 | 45 | deinit { 46 | observers.removeAllObjects() 47 | 48 | stopObservingSystemVolumeChanges() 49 | stopObservingApplicationStateChanges() 50 | } 51 | 52 | public func volumeChanged(to volume: Float) { 53 | for case let observer as SystemVolumeObserver in observers.objectEnumerator() { 54 | observer.volumeChanged(to: volume) 55 | } 56 | } 57 | } 58 | 59 | // System Volume Changes 60 | internal extension SystemVolumeManager { 61 | func startObservingSystemVolumeChanges() { 62 | try? AVAudioSession.sharedInstance().setActive(true) 63 | 64 | if !isObservingSystemVolumeChanges { 65 | // Observe system volume changes 66 | AVAudioSession.sharedInstance().addObserver(self, forKeyPath: #keyPath(AVAudioSession.outputVolume), options: [.old, .new], context: nil) 67 | 68 | // We need to manually set this to avoid adding ourselves as an observer twice. 69 | // This can happen if VolumeBar is started and the app has just launched. 70 | // Without this, KVO retains us and we crash when system volume changes after stop() is called. :( 71 | isObservingSystemVolumeChanges = true 72 | } 73 | } 74 | 75 | func stopObservingSystemVolumeChanges() { 76 | // Stop observing system volume changes 77 | if isObservingSystemVolumeChanges { 78 | AVAudioSession.sharedInstance().removeObserver(self, forKeyPath: #keyPath(AVAudioSession.outputVolume)) 79 | isObservingSystemVolumeChanges = false 80 | } 81 | } 82 | 83 | /// Observe changes in volume. 84 | /// 85 | /// This method is called when the user presses either of the volume buttons. 86 | override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) { 87 | let volume = AVAudioSession.sharedInstance().outputVolume 88 | volumeChanged(to: volume) 89 | } 90 | } 91 | 92 | // Application State Changes 93 | internal extension SystemVolumeManager { 94 | func startObservingApplicationStateChanges() { 95 | // Add application state observers 96 | NotificationCenter.default.addObserver(self, selector: #selector(SystemVolumeManager.applicationWillResignActive(notification:)), name: UIApplication.willResignActiveNotification, object: nil) 97 | NotificationCenter.default.addObserver(self, selector: #selector(SystemVolumeManager.applicationDidBecomeActive(notification:)), name: UIApplication.didBecomeActiveNotification, object: nil) 98 | } 99 | 100 | func stopObservingApplicationStateChanges() { 101 | // Remove application state observers 102 | NotificationCenter.default.removeObserver(self, name: UIApplication.willResignActiveNotification, object: nil) 103 | NotificationCenter.default.removeObserver(self, name: UIApplication.didBecomeActiveNotification, object: nil) 104 | } 105 | 106 | /// Observe when the application background state changes. 107 | @objc func applicationWillResignActive(notification: Notification) { 108 | // Stop observing volume while in the background 109 | stopObservingSystemVolumeChanges() 110 | } 111 | 112 | @objc func applicationDidBecomeActive(notification: Notification) { 113 | // Restart session after becoming active 114 | startObservingSystemVolumeChanges() 115 | } 116 | } 117 | 118 | // Volume Manager Observers 119 | internal extension SystemVolumeManager { 120 | func addObserver(_ observer: SystemVolumeObserver) { 121 | observers.add(observer) 122 | } 123 | 124 | func removeObserver(_ observer: SystemVolumeObserver) { 125 | observers.remove(observer) 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /Sources/Internal/VolumeBarStackView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VolumeBarStackView.swift 3 | // 4 | // Copyright (c) 2016-Present Sachin Patel (http://gizmosachin.com) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import UIKit 26 | import AVFoundation 27 | 28 | /// The internal view used by `VolumeBar`. 29 | internal final class VolumeBarStackView: UIStackView { 30 | internal let trackView: UIView 31 | 32 | // MARK: - Init 33 | public required init() { 34 | trackView = UIView() 35 | 36 | super.init(frame: .zero) 37 | 38 | // Layout properties 39 | axis = .horizontal 40 | distribution = .fillEqually 41 | 42 | // Add track view 43 | trackView.autoresizingMask = [.flexibleHeight, .flexibleWidth] 44 | insertSubview(trackView, at: 0) 45 | } 46 | 47 | public required init(coder aDecoder: NSCoder) { 48 | fatalError("Please use VolumeBar.shared instead of instantiating VolumeBarStackView directly.") 49 | } 50 | 51 | internal func apply(style: VolumeBarStyle) { 52 | // Layout 53 | self.spacing = style.segmentSpacing 54 | 55 | // Remove existing segment views 56 | arrangedSubviews.forEach(removeArrangedSubview) 57 | 58 | // Add segment views 59 | (0.. Void) 39 | 40 | public typealias CompletionHandler = ((Bool) -> Void) 41 | 42 | public var animationBlock: VolumeBarAnimation.Block 43 | 44 | public init(_ animationBlock: @escaping VolumeBarAnimation.Block) { 45 | self.animationBlock = animationBlock 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sources/VolumeBarStyle+Presets.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VolumeBarStyle+Presets.swift 3 | // 4 | // Copyright (c) 2016-Present Sachin Patel (http://gizmosachin.com) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import UIKit 26 | 27 | public extension VolumeBarStyle { 28 | 29 | // MARK: Presets 30 | 31 | /// A volume bar style like Instagram, where the bar is a continuous progress view 32 | /// that displays to the left of the notch on iPhone X and covers the full width 33 | /// of the iOS status bar on all other iOS devices. 34 | static let likeInstagram: VolumeBarStyle = UIDevice.current.volumeBar_isiPhoneX ? .leftOfNotch : .fullWidthContinuous 35 | 36 | /// A volume bar style like Snapchat, where the bar is a segmented progress view 37 | /// that displays under the notch and status bar on iPhone X (respecting the device's 38 | /// safe area insets) and covers the iOS status bar on all other iOS devices. 39 | static let likeSnapchat: VolumeBarStyle = { 40 | var style = VolumeBarStyle() 41 | style.height = 5 42 | style.respectsSafeAreaInsets = UIDevice.current.volumeBar_isiPhoneX 43 | style.edgeInsets = UIEdgeInsets(top: 2, left: 2, bottom: 0, right: 2) 44 | style.segmentSpacing = 2 45 | style.segmentCount = 8 46 | 47 | style.progressTintColor = #colorLiteral(red: 0.2558486164, green: 0.2558816075, blue: 0.2558295727, alpha: 1) 48 | style.trackTintColor = .white 49 | style.backgroundColor = .white 50 | return style 51 | }() 52 | 53 | /// A volume bar style that displays a continuous progress view and has minimal insets. 54 | static let fullWidthContinuous: VolumeBarStyle = { 55 | var style = VolumeBarStyle() 56 | style.height = 5 57 | style.cornerRadius = 3 58 | style.edgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 0, right: 10) 59 | 60 | style.progressTintColor = #colorLiteral(red: 0.2558486164, green: 0.2558816075, blue: 0.2558295727, alpha: 1) 61 | style.trackTintColor = #colorLiteral(red: 0.8537222743, green: 0.8538187146, blue: 0.8536666036, alpha: 1) 62 | style.backgroundColor = .white 63 | return style 64 | }() 65 | 66 | /// A volume bar style that displays to the left of the notch on iPhone X. 67 | static let leftOfNotch: VolumeBarStyle = { 68 | var style = VolumeBarStyle() 69 | style.height = 5 70 | style.cornerRadius = 3 71 | style.edgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 5, right: 300) 72 | 73 | style.progressTintColor = #colorLiteral(red: 0.2558486164, green: 0.2558816075, blue: 0.2558295727, alpha: 1) 74 | style.trackTintColor = #colorLiteral(red: 0.8537222743, green: 0.8538187146, blue: 0.8536666036, alpha: 1) 75 | style.backgroundColor = .white 76 | return style 77 | }() 78 | 79 | /// A volume bar style that displays to the right of the notch on iPhone X. 80 | static let rightOfNotch: VolumeBarStyle = { 81 | var style = VolumeBarStyle() 82 | style.height = 5 83 | style.cornerRadius = 3 84 | style.edgeInsets = UIEdgeInsets(top: 20, left: 300, bottom: 5, right: 20) 85 | 86 | style.progressTintColor = #colorLiteral(red: 0.2558486164, green: 0.2558816075, blue: 0.2558295727, alpha: 1) 87 | style.trackTintColor = #colorLiteral(red: 0.8537222743, green: 0.8538187146, blue: 0.8536666036, alpha: 1) 88 | style.backgroundColor = .white 89 | return style 90 | }() 91 | } 92 | 93 | /// :nodoc: 94 | public extension UIDevice { 95 | var volumeBar_isiPhoneX: Bool { 96 | #if arch(i386) || arch(x86_64) 97 | // We're running on the simulator, so use that to get the simulated model identifier. 98 | let identifier = ProcessInfo.processInfo.environment["SIMULATOR_MODEL_IDENTIFIER"] 99 | #else 100 | // From https://github.com/dennisweissmann/DeviceKit/blob/master/Source/Device.generated.swift 101 | var systemInfo = utsname() 102 | uname(&systemInfo) 103 | let mirror = Mirror(reflecting: systemInfo.machine) 104 | let identifier = mirror.children.reduce("") { identifier, element in 105 | guard let value = element.value as? Int8, value != 0 else { return identifier } 106 | return identifier + String(UnicodeScalar(UInt8(value))) 107 | } 108 | #endif 109 | 110 | return identifier == "iPhone10,3" || identifier == "iPhone10,6" 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Sources/VolumeBarStyle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VolumeBarStyle.swift 3 | // 4 | // Copyright (c) 2016-Present Sachin Patel (http://gizmosachin.com) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | import UIKit 25 | 26 | /// A value type wrapping parameters used to customize the appearance of VolumeBar. 27 | public struct VolumeBarStyle { 28 | // MARK: Layout 29 | 30 | /// The height of the bar that will be displayed on screen. 31 | public var height: CGFloat = 10 32 | 33 | /// Insets from the top edge of the device screen. 34 | /// 35 | /// If `respectsSafeAreaInsets` is `false`, VolumeBar will be inset from screen edges 36 | /// by exactly these insets. 37 | /// 38 | /// If `respectsSafeAreaInsets` is `true`, VolumeBar will be 39 | /// inset by the sum of the safe area insets of the device and `edgeInsets`. 40 | /// 41 | /// - seealso: `respectsSafeAreaInsets` 42 | public var edgeInsets: UIEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5) 43 | 44 | /// Whether or not VolumeBar should respect `safeAreaInsets` when displaying. 45 | /// 46 | /// - seealso: `edgeInsets` 47 | public var respectsSafeAreaInsets: Bool = false 48 | 49 | // MARK: Appearance 50 | 51 | /// The number of segments that the VolumeBar is made up of. 52 | /// Use this with `segmentSpacing` to give VolumeBar a segmented appearance. 53 | /// 54 | /// The default value, 16, is equal to the number of volume steps on iOS devices. 55 | /// (When the volume is 0%, pressing volume up exactly 16 times will cause the volume to reach 100%) 56 | /// 57 | /// - seealso: `segmentSpacing` 58 | public var segmentCount: UInt = 16 59 | 60 | /// The number of points between individual segments in the VolumeBar. 61 | /// 62 | /// - seealso: `segmentCount` 63 | public var segmentSpacing: CGFloat = 0 64 | 65 | /// The corner radius of the VolumeBar. 66 | public var cornerRadius: CGFloat = 0 67 | 68 | // MARK: Colors 69 | 70 | /// The color of the progress displayed on the bar. 71 | public var progressTintColor: UIColor = .black 72 | 73 | /// The background color of the track. 74 | public var trackTintColor: UIColor = UIColor.black.withAlphaComponent(0.5) 75 | 76 | /// The background color behind the track view. 77 | /// This should match the color of the view behind the VolumeBar, which might be the color of your navigation bar. 78 | public var backgroundColor: UIColor = .white 79 | } 80 | -------------------------------------------------------------------------------- /VolumeBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/VolumeBar.gif -------------------------------------------------------------------------------- /VolumeBar.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'VolumeBar' 3 | s.version = '3.1' 4 | s.swift_version = '5.0' 5 | s.summary = 'A volume indicator that doesn\'t obstruct content.' 6 | s.homepage = 'https://gizmosachin.github.io/VolumeBar/' 7 | s.license = 'MIT' 8 | s.social_media_url = 'https://twitter.com/gizmosachin' 9 | s.author = { 'Sachin Patel' => 'me@gizmosachin.com' } 10 | s.source = { :git => 'https://github.com/gizmosachin/VolumeBar.git', :tag => s.version } 11 | s.ios.deployment_target = '9.0' 12 | s.source_files = 'Sources/*.swift', 'Sources/Internal/*.swift' 13 | s.requires_arc = true 14 | s.frameworks = 'Foundation', 'UIKit', 'CoreGraphics', 'QuartzCore' 15 | s.documentation_url = 'https://gizmosachin.github.io/VolumeBar/' 16 | end 17 | -------------------------------------------------------------------------------- /VolumeBar/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /VolumeBar/VolumeBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VolumeBar/VolumeBar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /VolumeBar/VolumeBar.xcodeproj/xcshareddata/xcschemes/VolumeBar.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /build_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Docs by jazzy 4 | # https://github.com/realm/jazzy 5 | # ------------------------------ 6 | 7 | jazzy \ 8 | --module 'VolumeBar' \ 9 | --source-directory 'VolumeBar' \ 10 | --readme './README.md' \ 11 | --author 'Sachin Patel' \ 12 | --author_url 'https://gizmosachin.com' \ 13 | --github_url 'https://github.com/gizmosachin/VolumeBar' \ 14 | --root-url 'https://gizmosachin.github.io/VolumeBar/docs' \ 15 | --xcodebuild-arguments -scheme,VolumeBar \ 16 | --copyright '© 2018 [Sachin Patel](http://gizmosachin.com).' \ 17 | 18 | # Open docs in browser 19 | open ./docs/index.html -------------------------------------------------------------------------------- /docs/Classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 |

Classes

56 |

The following classes are available globally.

57 | 58 |
59 |
60 |
61 |
    62 |
  • 63 |
    64 | 65 | 66 | 67 | VolumeBar 68 | 69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 | 76 | See more 77 |
    78 |
    79 |
    80 |
  • 81 |
82 |
83 |
84 |
85 | 89 |
90 |
91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /docs/Classes/VolumeBar/AnimationStyle.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AnimationStyle Enum Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

VolumeBar Docs (100% documented)

18 |

View on GitHub

19 |

Install in Dash

20 |
21 |
22 |
23 | 28 |
29 |
30 | 53 |
54 |
55 |
56 |

AnimationStyle

57 |
58 |
59 |
public enum AnimationStyle
60 | 61 |
62 |
63 |

A set of animation styles.

64 | 65 |
66 |
67 |
68 |
    69 |
  • 70 |
    71 | 72 | 73 | 74 | slide 75 | 76 |
    77 |
    78 |
    79 |
    80 |
    81 |
    82 |

    Slide in and out of view from the top of the screen.

    83 | 84 |
    85 |
    86 |

    Declaration

    87 |
    88 |

    Swift

    89 |
    case slide
    90 | 91 |
    92 |
    93 |
    94 |
    95 |
  • 96 |
97 |
98 |
99 |
    100 |
  • 101 |
    102 | 103 | 104 | 105 | fade 106 | 107 |
    108 |
    109 |
    110 |
    111 |
    112 |
    113 |

    Fade in and out.

    114 | 115 |
    116 |
    117 |

    Declaration

    118 |
    119 |

    Swift

    120 |
    case fade
    121 | 122 |
    123 |
    124 |
    125 |
    126 |
  • 127 |
128 |
129 |
130 |
131 | 135 |
136 |
137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /docs/Extensions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Extensions Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 68 |
69 |
70 |
71 |

Extensions

72 |

The following extensions are available globally.

73 | 74 |
75 |
76 |
77 |
    78 |
  • 79 |
    80 | 81 | 82 | 83 | UIDevice 84 | 85 |
    86 |
    87 |
    88 |
    89 |
    90 |
    91 | 92 | See more 93 |
    94 |
    95 |
    96 |
  • 97 |
98 |
99 |
100 |
101 | 105 |
106 |
107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /docs/Extensions/UIDevice.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UIDevice Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

VolumeBar Docs (100% documented)

18 |

View on GitHub

19 |

Install in Dash

20 |
21 |
22 |
23 | 28 |
29 |
30 | 69 |
70 |
71 |
72 |

UIDevice

73 | 74 |
75 |
76 |
77 |
    78 |
  • 79 |
    80 | 81 | 82 | 83 | volumeBar_isiPhoneX 84 | 85 |
    86 |
    87 |
    88 |
    89 |
    90 |
    91 | 92 |
    93 |
    94 |
    95 |
  • 96 |
97 |
98 |
99 |
100 | 104 |
105 |
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/Protocols.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Protocols Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 |

Protocols

56 |

The following protocols are available globally.

57 | 58 |
59 |
60 |
61 |
    62 |
  • 63 |
    64 | 65 | 66 | 67 | VolumeDelegate 68 | 69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 |

    Conforming types can receive notifications on when the VolumeBar shows and hides.

    76 | 77 | See more 78 |
    79 |
    80 |

    Declaration

    81 |
    82 |

    Swift

    83 |
    public protocol VolumeDelegate
    84 | 85 |
    86 |
    87 |
    88 |
    89 |
  • 90 |
91 |
92 |
93 |
94 | 98 |
99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /docs/Protocols/VolumeDelegate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VolumeDelegate Protocol Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

VolumeBar Docs (100% documented)

18 |

View on GitHub

19 |

Install in Dash

20 |
21 |
22 |
23 | 28 |
29 |
30 | 53 |
54 |
55 |
56 |

VolumeDelegate

57 |
58 |
59 |
public protocol VolumeDelegate
60 | 61 |
62 |
63 |

Conforming types can receive notifications on when the VolumeBar shows and hides.

64 | 65 |
66 |
67 |
68 |
    69 |
  • 70 |
    71 | 72 | 73 | 74 | volumeBarWillShow(_:) 75 | 76 |
    77 |
    78 |
    79 |
    80 |
    81 |
    82 |

    Notifies the delegate that a VolumeBar is about to be shown.

    83 | 84 |
    85 |
    86 |

    Declaration

    87 |
    88 |

    Swift

    89 |
    func volumeBarWillShow(_ volumeBar: VolumeBar)
    90 | 91 |
    92 |
    93 |
    94 |

    Parameters

    95 | 96 | 97 | 98 | 103 | 108 | 109 | 110 |
    99 | 100 | volumeBar 101 | 102 | 104 |
    105 |

    The volume bar.

    106 |
    107 |
    111 |
    112 |
    113 |
    114 |
  • 115 |
  • 116 |
    117 | 118 | 119 | 120 | volumeBarDidHide(_:) 121 | 122 |
    123 |
    124 |
    125 |
    126 |
    127 |
    128 |

    Notifies the delegate that a VolumeBar was hidden.

    129 | 130 |
    131 |
    132 |

    Declaration

    133 |
    134 |

    Swift

    135 |
    func volumeBarDidHide(_ volumeBar: VolumeBar)
    136 | 137 |
    138 |
    139 |
    140 |

    Parameters

    141 | 142 | 143 | 144 | 149 | 154 | 155 | 156 |
    145 | 146 | volumeBar 147 | 148 | 150 |
    151 |

    The volume bar.

    152 |
    153 |
    157 |
    158 |
    159 |
    160 |
  • 161 |
162 |
163 |
164 |
165 | 169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/Structs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Structs Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 |

Structs

56 |

The following structs are available globally.

57 | 58 |
59 |
60 |
61 |
    62 |
  • 63 |
    64 | 65 | 66 | 67 | VolumeBarStyle 68 | 69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 |

    A value type wrapping parameters used to customize the appearance of VolumeBar.

    76 | 77 | See more 78 |
    79 |
    80 |

    Declaration

    81 |
    82 |

    Swift

    83 |
    public struct VolumeBarStyle
    84 | 85 |
    86 |
    87 |
    88 |
    89 |
  • 90 |
91 |
92 |
93 |
    94 |
  • 95 |
    96 | 97 | 98 | 99 | VolumeBarAnimation 100 | 101 |
    102 |
    103 |
    104 |
    105 |
    106 |
    107 |

    A value type wrapping a VolumeBarAnimationBlock.

    108 | 109 | See more 110 |
    111 |
    112 |

    Declaration

    113 |
    114 |

    Swift

    115 |
    public struct VolumeBarAnimation
    116 | 117 |
    118 |
    119 |
    120 |
    121 |
  • 122 |
123 |
124 |
125 |
126 | 130 |
131 |
132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /docs/Typealiases.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Typealiases Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 60 |
61 |
62 |
63 |

Typealiases

64 |

The following typealiases are available globally.

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | VolumeBarAnimationBlock 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 |

    A block used to animate VolumeBar.

    84 | 85 |

    VolumeBar does not perform any state changes before animations. 86 | Your block is responsible for the full lifecycle of your animation. 87 | See VolumeBarAnimation+Presets.swift for examples of how to do this.

    88 | 89 |

    Parameters:

    90 | 91 |
      92 |
    • view: The internal view to operate on as part of this animation.
    • 93 |
    • completionHandler: The completion handler that you must call when your animation completes.
    • 94 |
    95 | 96 |
    97 |
    98 |

    Declaration

    99 |
    100 |

    Swift

    101 |
    public typealias VolumeBarAnimationBlock = ((UIView, VolumeBarAnimationCompletionHandler?) -> Void)
    102 | 103 |
    104 |
    105 |
    106 |
    107 |
  • 108 |
109 |
110 |
111 |
112 | 116 |
117 |
118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /docs/badge.svg: -------------------------------------------------------------------------------- 1 | documentationdocumentation100%100% -------------------------------------------------------------------------------- /docs/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /docs/css/jazzy.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 2 | background: transparent; 3 | border: 0; 4 | margin: 0; 5 | outline: 0; 6 | padding: 0; 7 | vertical-align: baseline; } 8 | 9 | body { 10 | background-color: #f2f2f2; 11 | font-family: Helvetica, freesans, Arial, sans-serif; 12 | font-size: 14px; 13 | -webkit-font-smoothing: subpixel-antialiased; 14 | word-wrap: break-word; } 15 | 16 | h1, h2, h3 { 17 | margin-top: 0.8em; 18 | margin-bottom: 0.3em; 19 | font-weight: 100; 20 | color: black; } 21 | 22 | h1 { 23 | font-size: 2.5em; } 24 | 25 | h2 { 26 | font-size: 2em; 27 | border-bottom: 1px solid #e2e2e2; } 28 | 29 | h4 { 30 | font-size: 13px; 31 | line-height: 1.5; 32 | margin-top: 21px; } 33 | 34 | h5 { 35 | font-size: 1.1em; } 36 | 37 | h6 { 38 | font-size: 1.1em; 39 | color: #777; } 40 | 41 | .section-name { 42 | color: gray; 43 | display: block; 44 | font-family: Helvetica; 45 | font-size: 22px; 46 | font-weight: 100; 47 | margin-bottom: 15px; } 48 | 49 | pre, code { 50 | font: 0.95em Menlo, monospace; 51 | color: #777; 52 | word-wrap: normal; } 53 | 54 | p code, li code { 55 | background-color: #eee; 56 | padding: 2px 4px; 57 | border-radius: 4px; } 58 | 59 | a { 60 | color: #0088cc; 61 | text-decoration: none; } 62 | 63 | ul { 64 | padding-left: 15px; } 65 | 66 | li { 67 | line-height: 1.8em; } 68 | 69 | img { 70 | max-width: 100%; } 71 | 72 | blockquote { 73 | margin-left: 0; 74 | padding: 0 10px; 75 | border-left: 4px solid #ccc; } 76 | 77 | .content-wrapper { 78 | margin: 0 auto; 79 | width: 980px; } 80 | 81 | header { 82 | font-size: 0.85em; 83 | line-height: 26px; 84 | background-color: #414141; 85 | position: fixed; 86 | width: 100%; 87 | z-index: 1; } 88 | header img { 89 | padding-right: 6px; 90 | vertical-align: -4px; 91 | height: 16px; } 92 | header a { 93 | color: #fff; } 94 | header p { 95 | float: left; 96 | color: #999; } 97 | header .header-right { 98 | float: right; 99 | margin-left: 16px; } 100 | 101 | #breadcrumbs { 102 | background-color: #f2f2f2; 103 | height: 27px; 104 | padding-top: 17px; 105 | position: fixed; 106 | width: 100%; 107 | z-index: 1; 108 | margin-top: 26px; } 109 | #breadcrumbs #carat { 110 | height: 10px; 111 | margin: 0 5px; } 112 | 113 | .sidebar { 114 | background-color: #f9f9f9; 115 | border: 1px solid #e2e2e2; 116 | overflow-y: auto; 117 | overflow-x: hidden; 118 | position: fixed; 119 | top: 70px; 120 | bottom: 0; 121 | width: 230px; 122 | word-wrap: normal; } 123 | 124 | .nav-groups { 125 | list-style-type: none; 126 | background: #fff; 127 | padding-left: 0; } 128 | 129 | .nav-group-name { 130 | border-bottom: 1px solid #e2e2e2; 131 | font-size: 1.1em; 132 | font-weight: 100; 133 | padding: 15px 0 15px 20px; } 134 | .nav-group-name > a { 135 | color: #333; } 136 | 137 | .nav-group-tasks { 138 | margin-top: 5px; } 139 | 140 | .nav-group-task { 141 | font-size: 0.9em; 142 | list-style-type: none; 143 | white-space: nowrap; } 144 | .nav-group-task a { 145 | color: #888; } 146 | 147 | .main-content { 148 | background-color: #fff; 149 | border: 1px solid #e2e2e2; 150 | margin-left: 246px; 151 | position: absolute; 152 | overflow: hidden; 153 | padding-bottom: 60px; 154 | top: 70px; 155 | width: 734px; } 156 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 157 | margin-bottom: 1em; } 158 | .main-content p { 159 | line-height: 1.8em; } 160 | .main-content section .section:first-child { 161 | margin-top: 0; 162 | padding-top: 0; } 163 | .main-content section .task-group-section .task-group:first-of-type { 164 | padding-top: 10px; } 165 | .main-content section .task-group-section .task-group:first-of-type .section-name { 166 | padding-top: 15px; } 167 | .main-content section .heading:before { 168 | content: ""; 169 | display: block; 170 | padding-top: 70px; 171 | margin: -70px 0 0; } 172 | 173 | .section { 174 | padding: 0 25px; } 175 | 176 | .highlight { 177 | background-color: #eee; 178 | padding: 10px 12px; 179 | border: 1px solid #e2e2e2; 180 | border-radius: 4px; 181 | overflow-x: auto; } 182 | 183 | .declaration .highlight { 184 | overflow-x: initial; 185 | padding: 0 40px 40px 0; 186 | margin-bottom: -25px; 187 | background-color: transparent; 188 | border: none; } 189 | 190 | .section-name { 191 | margin: 0; 192 | margin-left: 18px; } 193 | 194 | .task-group-section { 195 | padding-left: 6px; 196 | border-top: 1px solid #e2e2e2; } 197 | 198 | .task-group { 199 | padding-top: 0px; } 200 | 201 | .task-name-container a[name]:before { 202 | content: ""; 203 | display: block; 204 | padding-top: 70px; 205 | margin: -70px 0 0; } 206 | 207 | .item { 208 | padding-top: 8px; 209 | width: 100%; 210 | list-style-type: none; } 211 | .item a[name]:before { 212 | content: ""; 213 | display: block; 214 | padding-top: 70px; 215 | margin: -70px 0 0; } 216 | .item code { 217 | background-color: transparent; 218 | padding: 0; } 219 | .item .token { 220 | padding-left: 3px; 221 | margin-left: 15px; 222 | font-size: 11.9px; } 223 | .item .declaration-note { 224 | font-size: .85em; 225 | color: gray; 226 | font-style: italic; } 227 | 228 | .pointer-container { 229 | border-bottom: 1px solid #e2e2e2; 230 | left: -23px; 231 | padding-bottom: 13px; 232 | position: relative; 233 | width: 110%; } 234 | 235 | .pointer { 236 | background: #f9f9f9; 237 | border-left: 1px solid #e2e2e2; 238 | border-top: 1px solid #e2e2e2; 239 | height: 12px; 240 | left: 21px; 241 | top: -7px; 242 | -webkit-transform: rotate(45deg); 243 | -moz-transform: rotate(45deg); 244 | -o-transform: rotate(45deg); 245 | transform: rotate(45deg); 246 | position: absolute; 247 | width: 12px; } 248 | 249 | .height-container { 250 | display: none; 251 | left: -25px; 252 | padding: 0 25px; 253 | position: relative; 254 | width: 100%; 255 | overflow: hidden; } 256 | .height-container .section { 257 | background: #f9f9f9; 258 | border-bottom: 1px solid #e2e2e2; 259 | left: -25px; 260 | position: relative; 261 | width: 100%; 262 | padding-top: 10px; 263 | padding-bottom: 5px; } 264 | 265 | .aside, .language { 266 | padding: 6px 12px; 267 | margin: 12px 0; 268 | border-left: 5px solid #dddddd; 269 | overflow-y: hidden; } 270 | .aside .aside-title, .language .aside-title { 271 | font-size: 9px; 272 | letter-spacing: 2px; 273 | text-transform: uppercase; 274 | padding-bottom: 0; 275 | margin: 0; 276 | color: #aaa; 277 | -webkit-user-select: none; } 278 | .aside p:last-child, .language p:last-child { 279 | margin-bottom: 0; } 280 | 281 | .language { 282 | border-left: 5px solid #cde9f4; } 283 | .language .aside-title { 284 | color: #4b8afb; } 285 | 286 | .aside-warning { 287 | border-left: 5px solid #ff6666; } 288 | .aside-warning .aside-title { 289 | color: #ff0000; } 290 | 291 | .graybox { 292 | border-collapse: collapse; 293 | width: 100%; } 294 | .graybox p { 295 | margin: 0; 296 | word-break: break-word; 297 | min-width: 50px; } 298 | .graybox td { 299 | border: 1px solid #e2e2e2; 300 | padding: 5px 25px 5px 10px; 301 | vertical-align: middle; } 302 | .graybox tr td:first-of-type { 303 | text-align: right; 304 | padding: 7px; 305 | vertical-align: top; 306 | word-break: normal; 307 | width: 40px; } 308 | 309 | .slightly-smaller { 310 | font-size: 0.9em; } 311 | 312 | #footer { 313 | position: absolute; 314 | bottom: 10px; 315 | margin-left: 25px; } 316 | #footer p { 317 | margin: 0; 318 | color: #aaa; 319 | font-size: 0.8em; } 320 | 321 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 322 | display: none; } 323 | html.dash .main-content { 324 | width: 980px; 325 | margin-left: 0; 326 | border: none; 327 | width: 100%; 328 | top: 0; 329 | padding-bottom: 0; } 330 | html.dash .height-container { 331 | display: block; } 332 | html.dash .item .token { 333 | margin-left: 0; } 334 | html.dash .content-wrapper { 335 | width: auto; } 336 | html.dash #footer { 337 | position: static; } 338 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | com.jazzy.volumebar 7 | CFBundleName 8 | VolumeBar 9 | DocSetPlatformFamily 10 | volumebar 11 | isDashDocset 12 | 13 | dashIndexFilePath 14 | index.html 15 | isJavaScriptEnabled 16 | 17 | DashDocSetFamily 18 | dashtoc 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 |

Classes

56 |

The following classes are available globally.

57 | 58 |
59 |
60 |
61 |
    62 |
  • 63 |
    64 | 65 | 66 | 67 | VolumeBar 68 | 69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 | 76 | See more 77 |
    78 |
    79 |
    80 |
  • 81 |
82 |
83 |
84 |
85 | 89 |
90 |
91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Classes/VolumeBar/AnimationStyle.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AnimationStyle Enum Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

VolumeBar Docs (100% documented)

18 |

View on GitHub

19 |

Install in Dash

20 |
21 |
22 |
23 | 28 |
29 |
30 | 53 |
54 |
55 |
56 |

AnimationStyle

57 |
58 |
59 |
public enum AnimationStyle
60 | 61 |
62 |
63 |

A set of animation styles.

64 | 65 |
66 |
67 |
68 |
    69 |
  • 70 |
    71 | 72 | 73 | 74 | slide 75 | 76 |
    77 |
    78 |
    79 |
    80 |
    81 |
    82 |

    Slide in and out of view from the top of the screen.

    83 | 84 |
    85 |
    86 |

    Declaration

    87 |
    88 |

    Swift

    89 |
    case slide
    90 | 91 |
    92 |
    93 |
    94 |
    95 |
  • 96 |
97 |
98 |
99 |
    100 |
  • 101 |
    102 | 103 | 104 | 105 | fade 106 | 107 |
    108 |
    109 |
    110 |
    111 |
    112 |
    113 |

    Fade in and out.

    114 | 115 |
    116 |
    117 |

    Declaration

    118 |
    119 |

    Swift

    120 |
    case fade
    121 | 122 |
    123 |
    124 |
    125 |
    126 |
  • 127 |
128 |
129 |
130 |
131 | 135 |
136 |
137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Extensions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Extensions Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 68 |
69 |
70 |
71 |

Extensions

72 |

The following extensions are available globally.

73 | 74 |
75 |
76 |
77 |
    78 |
  • 79 |
    80 | 81 | 82 | 83 | UIDevice 84 | 85 |
    86 |
    87 |
    88 |
    89 |
    90 |
    91 | 92 | See more 93 |
    94 |
    95 |
    96 |
  • 97 |
98 |
99 |
100 |
101 | 105 |
106 |
107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Extensions/UIDevice.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UIDevice Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

VolumeBar Docs (100% documented)

18 |

View on GitHub

19 |

Install in Dash

20 |
21 |
22 |
23 | 28 |
29 |
30 | 69 |
70 |
71 |
72 |

UIDevice

73 | 74 |
75 |
76 |
77 |
    78 |
  • 79 |
    80 | 81 | 82 | 83 | volumeBar_isiPhoneX 84 | 85 |
    86 |
    87 |
    88 |
    89 |
    90 |
    91 | 92 |
    93 |
    94 |
    95 |
  • 96 |
97 |
98 |
99 |
100 | 104 |
105 |
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Protocols.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Protocols Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 |

Protocols

56 |

The following protocols are available globally.

57 | 58 |
59 |
60 |
61 |
    62 |
  • 63 |
    64 | 65 | 66 | 67 | VolumeDelegate 68 | 69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 |

    Conforming types can receive notifications on when the VolumeBar shows and hides.

    76 | 77 | See more 78 |
    79 |
    80 |

    Declaration

    81 |
    82 |

    Swift

    83 |
    public protocol VolumeDelegate
    84 | 85 |
    86 |
    87 |
    88 |
    89 |
  • 90 |
91 |
92 |
93 |
94 | 98 |
99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Protocols/VolumeDelegate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VolumeDelegate Protocol Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

VolumeBar Docs (100% documented)

18 |

View on GitHub

19 |

Install in Dash

20 |
21 |
22 |
23 | 28 |
29 |
30 | 53 |
54 |
55 |
56 |

VolumeDelegate

57 |
58 |
59 |
public protocol VolumeDelegate
60 | 61 |
62 |
63 |

Conforming types can receive notifications on when the VolumeBar shows and hides.

64 | 65 |
66 |
67 |
68 |
    69 |
  • 70 |
    71 | 72 | 73 | 74 | volumeBarWillShow(_:) 75 | 76 |
    77 |
    78 |
    79 |
    80 |
    81 |
    82 |

    Notifies the delegate that a VolumeBar is about to be shown.

    83 | 84 |
    85 |
    86 |

    Declaration

    87 |
    88 |

    Swift

    89 |
    func volumeBarWillShow(_ volumeBar: VolumeBar)
    90 | 91 |
    92 |
    93 |
    94 |

    Parameters

    95 | 96 | 97 | 98 | 103 | 108 | 109 | 110 |
    99 | 100 | volumeBar 101 | 102 | 104 |
    105 |

    The volume bar.

    106 |
    107 |
    111 |
    112 |
    113 |
    114 |
  • 115 |
  • 116 |
    117 | 118 | 119 | 120 | volumeBarDidHide(_:) 121 | 122 |
    123 |
    124 |
    125 |
    126 |
    127 |
    128 |

    Notifies the delegate that a VolumeBar was hidden.

    129 | 130 |
    131 |
    132 |

    Declaration

    133 |
    134 |

    Swift

    135 |
    func volumeBarDidHide(_ volumeBar: VolumeBar)
    136 | 137 |
    138 |
    139 |
    140 |

    Parameters

    141 | 142 | 143 | 144 | 149 | 154 | 155 | 156 |
    145 | 146 | volumeBar 147 | 148 | 150 |
    151 |

    The volume bar.

    152 |
    153 |
    157 |
    158 |
    159 |
    160 |
  • 161 |
162 |
163 |
164 |
165 | 169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Structs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Structs Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 |

Structs

56 |

The following structs are available globally.

57 | 58 |
59 |
60 |
61 |
    62 |
  • 63 |
    64 | 65 | 66 | 67 | VolumeBarStyle 68 | 69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 |

    A value type wrapping parameters used to customize the appearance of VolumeBar.

    76 | 77 | See more 78 |
    79 |
    80 |

    Declaration

    81 |
    82 |

    Swift

    83 |
    public struct VolumeBarStyle
    84 | 85 |
    86 |
    87 |
    88 |
    89 |
  • 90 |
91 |
92 |
93 |
    94 |
  • 95 |
    96 | 97 | 98 | 99 | VolumeBarAnimation 100 | 101 |
    102 |
    103 |
    104 |
    105 |
    106 |
    107 |

    A value type wrapping a VolumeBarAnimationBlock.

    108 | 109 | See more 110 |
    111 |
    112 |

    Declaration

    113 |
    114 |

    Swift

    115 |
    public struct VolumeBarAnimation
    116 | 117 |
    118 |
    119 |
    120 |
    121 |
  • 122 |
123 |
124 |
125 |
126 | 130 |
131 |
132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/Typealiases.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Typealiases Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 60 |
61 |
62 |
63 |

Typealiases

64 |

The following typealiases are available globally.

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | VolumeBarAnimationBlock 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 |

    A block used to animate VolumeBar.

    84 | 85 |

    VolumeBar does not perform any state changes before animations. 86 | Your block is responsible for the full lifecycle of your animation. 87 | See VolumeBarAnimation+Presets.swift for examples of how to do this.

    88 | 89 |

    Parameters:

    90 | 91 |
      92 |
    • view: The internal view to operate on as part of this animation.
    • 93 |
    • completionHandler: The completion handler that you must call when your animation completes.
    • 94 |
    95 | 96 |
    97 |
    98 |

    Declaration

    99 |
    100 |

    Swift

    101 |
    public typealias VolumeBarAnimationBlock = ((UIView, VolumeBarAnimationCompletionHandler?) -> Void)
    102 | 103 |
    104 |
    105 |
    106 |
    107 |
  • 108 |
109 |
110 |
111 |
112 | 116 |
117 |
118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/badge.svg: -------------------------------------------------------------------------------- 1 | documentationdocumentation100%100% -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/css/jazzy.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 2 | background: transparent; 3 | border: 0; 4 | margin: 0; 5 | outline: 0; 6 | padding: 0; 7 | vertical-align: baseline; } 8 | 9 | body { 10 | background-color: #f2f2f2; 11 | font-family: Helvetica, freesans, Arial, sans-serif; 12 | font-size: 14px; 13 | -webkit-font-smoothing: subpixel-antialiased; 14 | word-wrap: break-word; } 15 | 16 | h1, h2, h3 { 17 | margin-top: 0.8em; 18 | margin-bottom: 0.3em; 19 | font-weight: 100; 20 | color: black; } 21 | 22 | h1 { 23 | font-size: 2.5em; } 24 | 25 | h2 { 26 | font-size: 2em; 27 | border-bottom: 1px solid #e2e2e2; } 28 | 29 | h4 { 30 | font-size: 13px; 31 | line-height: 1.5; 32 | margin-top: 21px; } 33 | 34 | h5 { 35 | font-size: 1.1em; } 36 | 37 | h6 { 38 | font-size: 1.1em; 39 | color: #777; } 40 | 41 | .section-name { 42 | color: gray; 43 | display: block; 44 | font-family: Helvetica; 45 | font-size: 22px; 46 | font-weight: 100; 47 | margin-bottom: 15px; } 48 | 49 | pre, code { 50 | font: 0.95em Menlo, monospace; 51 | color: #777; 52 | word-wrap: normal; } 53 | 54 | p code, li code { 55 | background-color: #eee; 56 | padding: 2px 4px; 57 | border-radius: 4px; } 58 | 59 | a { 60 | color: #0088cc; 61 | text-decoration: none; } 62 | 63 | ul { 64 | padding-left: 15px; } 65 | 66 | li { 67 | line-height: 1.8em; } 68 | 69 | img { 70 | max-width: 100%; } 71 | 72 | blockquote { 73 | margin-left: 0; 74 | padding: 0 10px; 75 | border-left: 4px solid #ccc; } 76 | 77 | .content-wrapper { 78 | margin: 0 auto; 79 | width: 980px; } 80 | 81 | header { 82 | font-size: 0.85em; 83 | line-height: 26px; 84 | background-color: #414141; 85 | position: fixed; 86 | width: 100%; 87 | z-index: 1; } 88 | header img { 89 | padding-right: 6px; 90 | vertical-align: -4px; 91 | height: 16px; } 92 | header a { 93 | color: #fff; } 94 | header p { 95 | float: left; 96 | color: #999; } 97 | header .header-right { 98 | float: right; 99 | margin-left: 16px; } 100 | 101 | #breadcrumbs { 102 | background-color: #f2f2f2; 103 | height: 27px; 104 | padding-top: 17px; 105 | position: fixed; 106 | width: 100%; 107 | z-index: 1; 108 | margin-top: 26px; } 109 | #breadcrumbs #carat { 110 | height: 10px; 111 | margin: 0 5px; } 112 | 113 | .sidebar { 114 | background-color: #f9f9f9; 115 | border: 1px solid #e2e2e2; 116 | overflow-y: auto; 117 | overflow-x: hidden; 118 | position: fixed; 119 | top: 70px; 120 | bottom: 0; 121 | width: 230px; 122 | word-wrap: normal; } 123 | 124 | .nav-groups { 125 | list-style-type: none; 126 | background: #fff; 127 | padding-left: 0; } 128 | 129 | .nav-group-name { 130 | border-bottom: 1px solid #e2e2e2; 131 | font-size: 1.1em; 132 | font-weight: 100; 133 | padding: 15px 0 15px 20px; } 134 | .nav-group-name > a { 135 | color: #333; } 136 | 137 | .nav-group-tasks { 138 | margin-top: 5px; } 139 | 140 | .nav-group-task { 141 | font-size: 0.9em; 142 | list-style-type: none; 143 | white-space: nowrap; } 144 | .nav-group-task a { 145 | color: #888; } 146 | 147 | .main-content { 148 | background-color: #fff; 149 | border: 1px solid #e2e2e2; 150 | margin-left: 246px; 151 | position: absolute; 152 | overflow: hidden; 153 | padding-bottom: 60px; 154 | top: 70px; 155 | width: 734px; } 156 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 157 | margin-bottom: 1em; } 158 | .main-content p { 159 | line-height: 1.8em; } 160 | .main-content section .section:first-child { 161 | margin-top: 0; 162 | padding-top: 0; } 163 | .main-content section .task-group-section .task-group:first-of-type { 164 | padding-top: 10px; } 165 | .main-content section .task-group-section .task-group:first-of-type .section-name { 166 | padding-top: 15px; } 167 | .main-content section .heading:before { 168 | content: ""; 169 | display: block; 170 | padding-top: 70px; 171 | margin: -70px 0 0; } 172 | 173 | .section { 174 | padding: 0 25px; } 175 | 176 | .highlight { 177 | background-color: #eee; 178 | padding: 10px 12px; 179 | border: 1px solid #e2e2e2; 180 | border-radius: 4px; 181 | overflow-x: auto; } 182 | 183 | .declaration .highlight { 184 | overflow-x: initial; 185 | padding: 0 40px 40px 0; 186 | margin-bottom: -25px; 187 | background-color: transparent; 188 | border: none; } 189 | 190 | .section-name { 191 | margin: 0; 192 | margin-left: 18px; } 193 | 194 | .task-group-section { 195 | padding-left: 6px; 196 | border-top: 1px solid #e2e2e2; } 197 | 198 | .task-group { 199 | padding-top: 0px; } 200 | 201 | .task-name-container a[name]:before { 202 | content: ""; 203 | display: block; 204 | padding-top: 70px; 205 | margin: -70px 0 0; } 206 | 207 | .item { 208 | padding-top: 8px; 209 | width: 100%; 210 | list-style-type: none; } 211 | .item a[name]:before { 212 | content: ""; 213 | display: block; 214 | padding-top: 70px; 215 | margin: -70px 0 0; } 216 | .item code { 217 | background-color: transparent; 218 | padding: 0; } 219 | .item .token { 220 | padding-left: 3px; 221 | margin-left: 15px; 222 | font-size: 11.9px; } 223 | .item .declaration-note { 224 | font-size: .85em; 225 | color: gray; 226 | font-style: italic; } 227 | 228 | .pointer-container { 229 | border-bottom: 1px solid #e2e2e2; 230 | left: -23px; 231 | padding-bottom: 13px; 232 | position: relative; 233 | width: 110%; } 234 | 235 | .pointer { 236 | background: #f9f9f9; 237 | border-left: 1px solid #e2e2e2; 238 | border-top: 1px solid #e2e2e2; 239 | height: 12px; 240 | left: 21px; 241 | top: -7px; 242 | -webkit-transform: rotate(45deg); 243 | -moz-transform: rotate(45deg); 244 | -o-transform: rotate(45deg); 245 | transform: rotate(45deg); 246 | position: absolute; 247 | width: 12px; } 248 | 249 | .height-container { 250 | display: none; 251 | left: -25px; 252 | padding: 0 25px; 253 | position: relative; 254 | width: 100%; 255 | overflow: hidden; } 256 | .height-container .section { 257 | background: #f9f9f9; 258 | border-bottom: 1px solid #e2e2e2; 259 | left: -25px; 260 | position: relative; 261 | width: 100%; 262 | padding-top: 10px; 263 | padding-bottom: 5px; } 264 | 265 | .aside, .language { 266 | padding: 6px 12px; 267 | margin: 12px 0; 268 | border-left: 5px solid #dddddd; 269 | overflow-y: hidden; } 270 | .aside .aside-title, .language .aside-title { 271 | font-size: 9px; 272 | letter-spacing: 2px; 273 | text-transform: uppercase; 274 | padding-bottom: 0; 275 | margin: 0; 276 | color: #aaa; 277 | -webkit-user-select: none; } 278 | .aside p:last-child, .language p:last-child { 279 | margin-bottom: 0; } 280 | 281 | .language { 282 | border-left: 5px solid #cde9f4; } 283 | .language .aside-title { 284 | color: #4b8afb; } 285 | 286 | .aside-warning { 287 | border-left: 5px solid #ff6666; } 288 | .aside-warning .aside-title { 289 | color: #ff0000; } 290 | 291 | .graybox { 292 | border-collapse: collapse; 293 | width: 100%; } 294 | .graybox p { 295 | margin: 0; 296 | word-break: break-word; 297 | min-width: 50px; } 298 | .graybox td { 299 | border: 1px solid #e2e2e2; 300 | padding: 5px 25px 5px 10px; 301 | vertical-align: middle; } 302 | .graybox tr td:first-of-type { 303 | text-align: right; 304 | padding: 7px; 305 | vertical-align: top; 306 | word-break: normal; 307 | width: 40px; } 308 | 309 | .slightly-smaller { 310 | font-size: 0.9em; } 311 | 312 | #footer { 313 | position: absolute; 314 | bottom: 10px; 315 | margin-left: 25px; } 316 | #footer p { 317 | margin: 0; 318 | color: #aaa; 319 | font-size: 0.8em; } 320 | 321 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 322 | display: none; } 323 | html.dash .main-content { 324 | width: 980px; 325 | margin-left: 0; 326 | border: none; 327 | width: 100%; 328 | top: 0; 329 | padding-bottom: 0; } 330 | html.dash .height-container { 331 | display: block; } 332 | html.dash .item .token { 333 | margin-left: 0; } 334 | html.dash .content-wrapper { 335 | width: auto; } 336 | html.dash #footer { 337 | position: static; } 338 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/docsets/VolumeBar.docset/Contents/Resources/Documents/img/carat.png -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/docsets/VolumeBar.docset/Contents/Resources/Documents/img/dash.png -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/docsets/VolumeBar.docset/Contents/Resources/Documents/img/gh.png -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VolumeBar Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 | 56 |

VolumeBar

57 |

VolumeBar

58 | 59 |

VolumeBar is a Swift volume indicator that doesn’t obstruct content on screen.

60 | 61 |

Build Status Pod Version Swift Version GitHub license

62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 |
Features
:no_good:Hides system volume HUD automatically
:art:Customizable appearance with presets
:boom:Support for custom animations
:iphone:Works with iPhone X
:books:Fully documented
:baby_chick:Swift 4
94 |

Usage

95 | 96 |

It’s super easy to add VolumeBar to your app:

97 |
let volumeBar = VolumeBar.shared
 98 | volumeBar.style = .likeInstagram
 99 | volumeBar.start()
100 | 
101 | 102 |

Customize appearance attributes (see VolumeBarStyle):

103 |
let volumeBar = VolumeBar.shared
104 | let customStyle = VolumeBarStyle.likeInstagram
105 | customStyle.trackTintColor = .white
106 | customStyle.trackTintColor = .darkGray
107 | customStyle.backgroundColor = .black
108 | volumeBar.style = customStyle
109 | 
110 | 111 |

Or even use custom animations (see VolumeBarAnimation):

112 |
let volumeBar = VolumeBar.shared
113 | let fadeInAnimation = VolumeBarAnimation({ (view, completion) in
114 |     view.alpha = 0
115 |     UIView.animate(withDuration: 0.2, animations: {
116 |         view.alpha = 1
117 |     }, completion: completion)
118 | })
119 | volumeBar.showAnimation = fadeInAnimation
120 | 
121 |

Background Audio

122 | 123 |

If your app doesn’t do custom audio handling, adding VolumeBar will make background music (like Spotify) pause when your app is opened.

124 | 125 |

Prevent this by adding the following wherever you call VolumeBar.shared.start():

126 |
try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
127 | 
128 |

VolumeBar

129 | 130 |

VolumeBar is fully documented here.

131 |

Installation

132 |

CocoaPods

133 |
source 'https://github.com/CocoaPods/Specs.git'
134 | use_frameworks!
135 | 
136 | pod 'VolumeBar', '~> 2.0.6'
137 | 
138 |

Carthage

139 |
github "gizmosachin/VolumeBar" "master"
140 | 
141 |

Sample

142 | 143 |

Please see the Sample directory for a basic iOS project that uses VolumeBar.

144 |

Contributing

145 | 146 |

VolumeBar is a community - contributions and discussions are welcome!

147 | 148 |

Please read the contributing guidelines prior to submitting a Pull Request.

149 |

License

150 | 151 |

VolumeBar is available under the MIT license, see the LICENSE file for more information.

152 | 153 |
154 |
155 | 159 |
160 |
161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | // On doc load, toggle the URL hash discussion if present 12 | $(document).ready(function() { 13 | if (!window.jazzy.docset) { 14 | var linkToHash = $('a[href="' + window.location.hash +'"]'); 15 | linkToHash.trigger("click"); 16 | } 17 | }); 18 | 19 | // On token click, toggle its discussion and animate token.marginLeft 20 | $(".token").click(function(event) { 21 | if (window.jazzy.docset) { 22 | return; 23 | } 24 | var link = $(this); 25 | var animationDuration = 300; 26 | var tokenOffset = "15px"; 27 | var original = link.css('marginLeft') == tokenOffset; 28 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); 29 | $content = link.parent().parent().next(); 30 | $content.slideToggle(animationDuration); 31 | 32 | // Keeps the document from jumping to the hash. 33 | var href = $(this).attr('href'); 34 | if (history.pushState) { 35 | history.pushState({}, '', href); 36 | } else { 37 | location.hash = href; 38 | } 39 | event.preventDefault(); 40 | }); 41 | 42 | // Dumb down quotes within code blocks that delimit strings instead of quotations 43 | // https://github.com/realm/jazzy/issues/714 44 | $("code q").replaceWith(function () { 45 | return ["\"", $(this).contents(), "\""]; 46 | }); 47 | -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/search.json: -------------------------------------------------------------------------------- 1 | {"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV5Blocka":{"name":"Block","abstract":"

A block used to animate VolumeBar.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV14animationBlockySo6UIViewC_ySbcSgtcv":{"name":"animationBlock","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationVACySo6UIViewC_ySbcSgtccfc":{"name":"init(_:)","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV6fadeInACvZ":{"name":"fadeIn","abstract":"

A simple fade in animation.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV7fadeOutACvZ":{"name":"fadeOut","abstract":"

A simple fade out animation.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV14slideAndFadeInACvZ":{"name":"slideAndFadeIn","abstract":"

Fade in and slide down from above the status bar.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV15slideAndFadeOutACvZ":{"name":"slideAndFadeOut","abstract":"

Fade out and slide up to above the status bar.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV6height12CoreGraphics7CGFloatVv":{"name":"height","abstract":"

The height of the bar that will be displayed on screen.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV10edgeInsetsSC06UIEdgeE0Vv":{"name":"edgeInsets","abstract":"

Insets from the top edge of the device screen.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV22respectsSafeAreaInsetsSbv":{"name":"respectsSafeAreaInsets","abstract":"

Whether or not VolumeBar should respect safeAreaInsets when displaying.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12segmentCountSuv":{"name":"segmentCount","abstract":"

The number of segments that the VolumeBar is made up of.","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV14segmentSpacing12CoreGraphics7CGFloatVv":{"name":"segmentSpacing","abstract":"

The number of points between individual segments in the VolumeBar.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12cornerRadius12CoreGraphics7CGFloatVv":{"name":"cornerRadius","abstract":"

The corner radius of the VolumeBar.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV17progressTintColorSo7UIColorCv":{"name":"progressTintColor","abstract":"

The color of the progress displayed on the bar.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV14trackTintColorSo7UIColorCv":{"name":"trackTintColor","abstract":"

The background color of the track.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV15backgroundColorSo7UIColorCv":{"name":"backgroundColor","abstract":"

The background color behind the track view.","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV13likeInstagramACvZ":{"name":"likeInstagram","abstract":"

A volume bar style like Instagram, where the bar is a continuous progress view","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12likeSnapchatACvZ":{"name":"likeSnapchat","abstract":"

A volume bar style like Snapchat, where the bar is a segmented progress view","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV19fullWidthContinuousACvZ":{"name":"fullWidthContinuous","abstract":"

A volume bar style that displays a continuous progress view and has minimal insets.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV11leftOfNotchACvZ":{"name":"leftOfNotch","abstract":"

A volume bar style that displays to the left of the notch on iPhone X.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12rightOfNotchACvZ":{"name":"rightOfNotch","abstract":"

A volume bar style that displays to the right of the notch on iPhone X.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html":{"name":"VolumeBarStyle","abstract":"

A value type wrapping parameters used to customize the appearance of VolumeBar.

"},"Structs/VolumeBarAnimation.html":{"name":"VolumeBarAnimation","abstract":"

A value type wrapping a VolumeBarAnimationBlock.

"},"Classes/VolumeBar.html#/s:9VolumeBarAAC6sharedABvZ":{"name":"shared","abstract":"

The shared VolumeBar singleton.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4viewSo11UIStackViewCSgv":{"name":"view","abstract":"

The stack view that displays the volume bar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC22minimumVisibleDurationSdv":{"name":"minimumVisibleDuration","abstract":"

The minimum visible duration that VolumeBar will appear on screen after a volume button is pressed.","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC13showAnimationAA0abD0Vv":{"name":"showAnimation","abstract":"

The animation used to show VolumeBar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC13hideAnimationAA0abD0Vv":{"name":"hideAnimation","abstract":"

The animation used to hide VolumeBar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC5styleAA0aB5StyleVv":{"name":"style","abstract":"

The current style of VolumeBar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC5startyyF":{"name":"start()","abstract":"

Start VolumeBar and automatically show when the volume changes.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4stopyyF":{"name":"stop()","abstract":"

Stop VolumeBar from automatically showing when the volume changes.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4showyyF":{"name":"show()","abstract":"

Show VolumeBar immediately using the current showAnimation.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4hideyyF":{"name":"hide()","abstract":"

Show VolumeBar immediately using the current hideAnimation.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html":{"name":"VolumeBar"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structs","abstract":"

The following structs are available globally.

"}} -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/Documents/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | 4 | ], 5 | "source_directory": "/Users/sachin/Documents/Open Source/VolumeBar/VolumeBar" 6 | } -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.docset/Contents/Resources/docSet.dsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/docsets/VolumeBar.docset/Contents/Resources/docSet.dsidx -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/docsets/VolumeBar.tgz -------------------------------------------------------------------------------- /docs/docsets/VolumeBar.xml: -------------------------------------------------------------------------------- 1 | 2.0.6https://gizmosachin.github.io/VolumeBar/docsets/VolumeBar.tgz 2 | -------------------------------------------------------------------------------- /docs/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/img/carat.png -------------------------------------------------------------------------------- /docs/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/img/dash.png -------------------------------------------------------------------------------- /docs/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizmosachin/VolumeBar/bcb9c2be78b86eff6545efc69335d75e67537a0f/docs/img/gh.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VolumeBar Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

VolumeBar Docs (100% documented)

17 |

View on GitHub

18 |

Install in Dash

19 |
20 |
21 |
22 | 27 |
28 |
29 | 52 |
53 |
54 |
55 |

VolumeBar

56 | 57 |

VolumeBar is a Swift volume indicator that doesn’t obstruct content on screen.

58 | 59 |

Usage

60 | 61 |

It’s super easy to add VolumeBar to your app:

62 |
let volumeBar = VolumeBar.shared
 63 | volumeBar.style = .likeInstagram
 64 | volumeBar.start()
 65 | 
66 | 67 |

Customize appearance attributes (see VolumeBarStyle):

68 |
let volumeBar = VolumeBar.shared
 69 | let customStyle = VolumeBarStyle.likeInstagram
 70 | customStyle.trackTintColor = .white
 71 | customStyle.trackTintColor = .darkGray
 72 | customStyle.backgroundColor = .black
 73 | volumeBar.style = customStyle
 74 | 
75 | 76 |

Or even use custom animations (see VolumeBarAnimation):

77 |
let volumeBar = VolumeBar.shared
 78 | let fadeInAnimation = VolumeBarAnimation({ (view, completion) in
 79 |     view.alpha = 0
 80 |     UIView.animate(withDuration: 0.2, animations: {
 81 |         view.alpha = 1
 82 |     }, completion: completion)
 83 | })
 84 | volumeBar.showAnimation = fadeInAnimation
 85 | 
86 |

Background Audio

87 | 88 |

If your app doesn’t do custom audio handling, adding VolumeBar will make background music (like Spotify) pause when your app is opened.

89 | 90 |

Prevent this by adding the following wherever you call VolumeBar.shared.start():

91 |
try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
 92 | 
93 |

VolumeBar

94 | 95 |

VolumeBar is fully documented here.

96 |

Installation

97 |

CocoaPods

98 |
source 'https://github.com/CocoaPods/Specs.git'
 99 | use_frameworks!
100 | 
101 | pod 'VolumeBar', '~> 2.0.6'
102 | 
103 |

Carthage

104 |
github "gizmosachin/VolumeBar" "master"
105 | 
106 |

Sample

107 | 108 |

Please see the Sample directory for a basic iOS project that uses VolumeBar.

109 |

Contributing

110 | 111 |

VolumeBar is a community - contributions and discussions are welcome!

112 | 113 |

Please read the contributing guidelines prior to submitting a Pull Request.

114 |

License

115 | 116 |

VolumeBar is available under the MIT license, see the LICENSE file for more information.

117 | 118 |
119 |
120 | 124 |
125 |
126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /docs/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | // On doc load, toggle the URL hash discussion if present 12 | $(document).ready(function() { 13 | if (!window.jazzy.docset) { 14 | var linkToHash = $('a[href="' + window.location.hash +'"]'); 15 | linkToHash.trigger("click"); 16 | } 17 | }); 18 | 19 | // On token click, toggle its discussion and animate token.marginLeft 20 | $(".token").click(function(event) { 21 | if (window.jazzy.docset) { 22 | return; 23 | } 24 | var link = $(this); 25 | var animationDuration = 300; 26 | var tokenOffset = "15px"; 27 | var original = link.css('marginLeft') == tokenOffset; 28 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); 29 | $content = link.parent().parent().next(); 30 | $content.slideToggle(animationDuration); 31 | 32 | // Keeps the document from jumping to the hash. 33 | var href = $(this).attr('href'); 34 | if (history.pushState) { 35 | history.pushState({}, '', href); 36 | } else { 37 | location.hash = href; 38 | } 39 | event.preventDefault(); 40 | }); 41 | 42 | // Dumb down quotes within code blocks that delimit strings instead of quotations 43 | // https://github.com/realm/jazzy/issues/714 44 | $("code q").replaceWith(function () { 45 | return ["\"", $(this).contents(), "\""]; 46 | }); 47 | -------------------------------------------------------------------------------- /docs/search.json: -------------------------------------------------------------------------------- 1 | {"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV5Blocka":{"name":"Block","abstract":"

A block used to animate VolumeBar.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV14animationBlockySo6UIViewC_ySbcSgtcv":{"name":"animationBlock","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationVACySo6UIViewC_ySbcSgtccfc":{"name":"init(_:)","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV6fadeInACvZ":{"name":"fadeIn","abstract":"

A simple fade in animation.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV7fadeOutACvZ":{"name":"fadeOut","abstract":"

A simple fade out animation.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV14slideAndFadeInACvZ":{"name":"slideAndFadeIn","abstract":"

Fade in and slide down from above the status bar.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarAnimation.html#/s:9VolumeBar0aB9AnimationV15slideAndFadeOutACvZ":{"name":"slideAndFadeOut","abstract":"

Fade out and slide up to above the status bar.

","parent_name":"VolumeBarAnimation"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV6height12CoreGraphics7CGFloatVv":{"name":"height","abstract":"

The height of the bar that will be displayed on screen.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV10edgeInsetsSC06UIEdgeE0Vv":{"name":"edgeInsets","abstract":"

Insets from the top edge of the device screen.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV22respectsSafeAreaInsetsSbv":{"name":"respectsSafeAreaInsets","abstract":"

Whether or not VolumeBar should respect safeAreaInsets when displaying.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12segmentCountSuv":{"name":"segmentCount","abstract":"

The number of segments that the VolumeBar is made up of.","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV14segmentSpacing12CoreGraphics7CGFloatVv":{"name":"segmentSpacing","abstract":"

The number of points between individual segments in the VolumeBar.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12cornerRadius12CoreGraphics7CGFloatVv":{"name":"cornerRadius","abstract":"

The corner radius of the VolumeBar.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV17progressTintColorSo7UIColorCv":{"name":"progressTintColor","abstract":"

The color of the progress displayed on the bar.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV14trackTintColorSo7UIColorCv":{"name":"trackTintColor","abstract":"

The background color of the track.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV15backgroundColorSo7UIColorCv":{"name":"backgroundColor","abstract":"

The background color behind the track view.","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV13likeInstagramACvZ":{"name":"likeInstagram","abstract":"

A volume bar style like Instagram, where the bar is a continuous progress view","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12likeSnapchatACvZ":{"name":"likeSnapchat","abstract":"

A volume bar style like Snapchat, where the bar is a segmented progress view","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV19fullWidthContinuousACvZ":{"name":"fullWidthContinuous","abstract":"

A volume bar style that displays a continuous progress view and has minimal insets.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV11leftOfNotchACvZ":{"name":"leftOfNotch","abstract":"

A volume bar style that displays to the left of the notch on iPhone X.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html#/s:9VolumeBar0aB5StyleV12rightOfNotchACvZ":{"name":"rightOfNotch","abstract":"

A volume bar style that displays to the right of the notch on iPhone X.

","parent_name":"VolumeBarStyle"},"Structs/VolumeBarStyle.html":{"name":"VolumeBarStyle","abstract":"

A value type wrapping parameters used to customize the appearance of VolumeBar.

"},"Structs/VolumeBarAnimation.html":{"name":"VolumeBarAnimation","abstract":"

A value type wrapping a VolumeBarAnimationBlock.

"},"Classes/VolumeBar.html#/s:9VolumeBarAAC6sharedABvZ":{"name":"shared","abstract":"

The shared VolumeBar singleton.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4viewSo11UIStackViewCSgv":{"name":"view","abstract":"

The stack view that displays the volume bar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC22minimumVisibleDurationSdv":{"name":"minimumVisibleDuration","abstract":"

The minimum visible duration that VolumeBar will appear on screen after a volume button is pressed.","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC13showAnimationAA0abD0Vv":{"name":"showAnimation","abstract":"

The animation used to show VolumeBar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC13hideAnimationAA0abD0Vv":{"name":"hideAnimation","abstract":"

The animation used to hide VolumeBar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC5styleAA0aB5StyleVv":{"name":"style","abstract":"

The current style of VolumeBar.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC5startyyF":{"name":"start()","abstract":"

Start VolumeBar and automatically show when the volume changes.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4stopyyF":{"name":"stop()","abstract":"

Stop VolumeBar from automatically showing when the volume changes.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4showyyF":{"name":"show()","abstract":"

Show VolumeBar immediately using the current showAnimation.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html#/s:9VolumeBarAAC4hideyyF":{"name":"hide()","abstract":"

Show VolumeBar immediately using the current hideAnimation.

","parent_name":"VolumeBar"},"Classes/VolumeBar.html":{"name":"VolumeBar"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Structs.html":{"name":"Structs","abstract":"

The following structs are available globally.

"}} -------------------------------------------------------------------------------- /docs/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | 4 | ], 5 | "source_directory": "/Users/sachin/Documents/Open Source/VolumeBar/VolumeBar" 6 | } --------------------------------------------------------------------------------