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

Commit

Permalink
Merge pull request #15 from gizmosachin/3.0
Browse files Browse the repository at this point in the history
VolumeBar 3.0
  • Loading branch information
gizmosachin authored Mar 13, 2018
2 parents 4e467ca + 6416cc3 commit 0c27860
Show file tree
Hide file tree
Showing 56 changed files with 4,075 additions and 1,931 deletions.
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
language: objective-c
osx_image: xcode9
osx_image: xcode9.2
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
before_install:
- brew update
- brew reinstall xctool
- bundle install
script:
- xcodebuild -showsdks
- xcodebuild -project VolumeBar/VolumeBar.xcodeproj -scheme VolumeBar -sdk iphonesimulator11.0 build analyze

- xcodebuild -project VolumeBar/VolumeBar.xcodeproj -scheme VolumeBar -sdk iphonesimulator11.2 build analyze
- bundle exec pod lib lint --verbose
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### One issue or bug per Pull Request

Keep your Pull Requests small. Small PRs are easier to reason about which makes them significantly more likely to get merged.

### Issues before features

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.

### Forwards compatibility

Please do not write new code using deprecated APIs.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org' do
gem 'cocoapods', '~> 1.3.1'
gem 'jazzy', '~> 0.8.3'
end
103 changes: 103 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
activesupport (4.2.9)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
atomos (0.1.2)
claide (1.0.2)
cocoapods (1.3.1)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.3.1)
cocoapods-deintegrate (>= 1.0.1, < 2.0)
cocoapods-downloader (>= 1.1.3, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.2.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.5.7)
nap (~> 1.0)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.1, < 2.0)
cocoapods-core (1.3.1)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.1.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.0.5)
escape (0.0.4)
ffi (1.9.23)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jazzy (0.8.3)
cocoapods (~> 1.0)
mustache (~> 0.99)
open4
redcarpet (~> 3.2)
rouge (~> 1.5)
sass (~> 3.4)
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
liferaft (0.0.6)
minitest (5.11.3)
molinillo (0.5.7)
mustache (0.99.8)
nanaimo (0.2.3)
nap (1.1.0)
netrc (0.11.0)
open4 (1.3.4)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
redcarpet (3.4.0)
rouge (1.11.1)
ruby-macho (1.1.0)
sass (3.5.1)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sqlite3 (1.3.11)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcinvoke (0.3.0)
liferaft (~> 0.0.6)
xcodeproj (1.5.6)
CFPropertyList (~> 2.3.3)
atomos (~> 0.1.2)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.3.1)!
jazzy (~> 0.8.3)!

BUNDLED WITH
1.15.4
5 changes: 0 additions & 5 deletions Package.swift

This file was deleted.

148 changes: 43 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,105 +2,68 @@

## VolumeBar

`VolumeBar` is a [Swift](https://developer.apple.com/swift/) volume indicator that doesn't obstruct content on screen. A basic implementation is just one line of code, but it can be heavily customized via several appearance and presentation properties.
VolumeBar is a [Swift](https://developer.apple.com/swift/) volume indicator that doesn't obstruct content on screen.

### Features
- [x] Customizable appearance
- [x] Orientation change support
- [x] Hides system volume HUD automatically
- [x] Simple API
[![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%204.0-brightgreen.svg)](https://developer.apple.com/swift) [![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](LICENSE)

[![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?style=flat)](http://cocoadocs.org/docsets/VolumeBar/)
| | 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](http://gizmosachin.github.io/VolumeBar) |
| :baby_chick: | [Swift 4](https://developer.apple.com/swift/) |

## Version Compatibility

Current Swift compatibility breakdown:

| Swift Version | Framework Version |
| ------------- | ----------------- |
| 3.0 | master |
| 2.3 | 1.1 |
| 2.2 | 1.1 |

## Usage

A basic implementation of `VolumeBar` is just one line of code.
It's super easy to add VolumeBar to your app:

```swift
VolumeBar.sharedInstance.start()
let volumeBar = VolumeBar.shared
volumeBar.style = .likeInstagram
volumeBar.start()
```

By default, adding `VolumeBar` to your app will cause background audio to pause when your app is opened. To prevent this, add the following line of code wherever you call the `start` method:

Customize appearance attributes (see [`VolumeBarStyle`](http://gizmosachin.github.io/VolumeBar/docs/Structs/VolumeBarStyle.html)):
```swift
try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
let volumeBar = VolumeBar.shared
let customStyle = VolumeBarStyle.likeInstagram
customStyle.trackTintColor = .white
customStyle.trackTintColor = .darkGray
customStyle.backgroundColor = .black
volumeBar.style = customStyle
```

Calling the `start` method begins observing changes in the system volume. After calling `start`, `VolumeBar` will show automatically whenever your app is active and the volume changes. This is appropriate for most use cases. To stop observing changes and use the system volume HUD again, call `stop`:

Or even use custom animations (see [`VolumeBarAnimation`](http://gizmosachin.github.io/VolumeBar/docs/Structs/VolumeBarAnimation.html)):
```swift
VolumeBar.sharedInstance.stop()
let volumeBar = VolumeBar.shared
let fadeInAnimation = VolumeBarAnimation({ (view, completion) in
view.alpha = 0
UIView.animate(withDuration: 0.2, animations: {
view.alpha = 1
}, completion: completion)
})
volumeBar.showAnimation = fadeInAnimation
```

[Please see the documentation](http://gizmosachin.github.io/VolumeBar/docs) and check out the sample app (VolumeBarSample) for more details.
### Background Audio
If your app doesn't do custom audio handling, adding VolumeBar will make background music (like Spotify) pause when your app is opened.

****

##### Appearance

Customize tint color, bar tint color, and track tint color:
Prevent this by adding the following wherever you call `VolumeBar.shared.start()`:

```swift
VolumeBar.sharedInstance.tintColor = UIColor.white
VolumeBar.sharedInstance.backgroundColor = UIColor.black.withAlphaComponent(0.5)
VolumeBar.sharedInstance.trackTintColor = UIColor.clear
```

Customize layout properties:

```swift
VolumeBar.sharedInstance.barHeight = 5
VolumeBar.sharedInstance.segmentCount = 8
VolumeBar.sharedInstance.interitemSpacing = 5
```

****

##### Presentation

If `start` has been called, `VolumeBar` will automatically show when the system volume changes. You can also manually show and hide `VolumeBar`.

```swift
VolumeBar.sharedInstance.show()
VolumeBar.sharedInstance.hide()
```

Change the animation style:

```swift
VolumeBar.sharedInstance.animationStyle = .fade // default is .slide
VolumeBar.sharedInstance.animationDuration = 0.5
VolumeBar.sharedInstance.minimumVisibleDuration = 2.0
try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
```

****
### VolumeBar

##### Status Bar

`VolumeBar` needs to know when the status bar is hidden or changes style. These properties should be updated in the `viewWillAppear` method of each view controller.

```swift
VolumeBar.sharedInstance.statusBarHidden = false
VolumeBar.sharedInstance.statusBarStyle = .lightContent
```
VolumeBar is fully documented [here](http://gizmosachin.github.io/VolumeBar/docs).

## Installation

### CocoaPods

`VolumeBar` is available using the Cocoa dependency manager [CocoaPods](http://cocoapods.org/).

To integrate, add the following to your `Podfile`:
### [CocoaPods](http://cocoapods.org/)

```ruby
source 'https://github.com/CocoaPods/Specs.git'
Expand All @@ -109,44 +72,19 @@ use_frameworks!
pod 'VolumeBar', '~> 2.0.6'
```

### Carthage

Installation is also available using the dependency manager [Carthage](https://github.com/Carthage/Carthage). To integrate, add the following line to your `Cartfile`:
### [Carthage](https://github.com/Carthage/Carthage)

```ogdl
github "gizmosachin/VolumeBar" "master"
```

### Swift Package Manager

Installation is also available using the [Swift Package Manager](https://swift.org/package-manager/). To integrate, add the following to your `Package.swift`:

```swift
import PackageDescription

let package = Package(
name: "MyProject",
dependencies: [
.Package(url: "https://github.com/gizmosachin/VolumeBar.git", majorVersion: 0),
]
)
```

### Manual

You can also simply copy `VolumeBar.swift` into your Xcode project.

## Documentation

API documentation is [available here](http://gizmosachin.github.io/VolumeBar/docs).
## Sample
Please see the `Sample` directory for a basic iOS project that uses `VolumeBar`.

## Community
## Contributing
VolumeBar is a community - contributions and discussions are welcome!

- Need help? Use [Stack Overflow](http://stackoverflow.com/questions/tagged/volumebar-swift) with the tag 'volumebar-swift'.
- Questions? Use [Stack Overflow](http://stackoverflow.com/questions/tagged/volumebar-swift) with the tag 'volumebar-swift'.
- Found a bug? Open an [issue](https://github.com/gizmosachin/VolumeBar/issues).
- Feature idea? Open an [issue](https://github.com/gizmosachin/VolumeBar/issues).
- Want to contribute? Submit a [pull request](https://github.com/gizmosachin/VolumeBar/pulls).
Please read the [contributing guidelines](CONTRIBUTING.md) prior to submitting a Pull Request.

## License

Expand Down
Loading

0 comments on commit 0c27860

Please sign in to comment.