Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Swift Package Manager support #54

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription

let package = Package(
name: "SoundWave",
platforms: [
.iOS(.v10)
],
products: [
.library(name: "SoundWave", targets: ["SoundWave"]),
],
targets: [
.target(name: "SoundWave", path: "SoundWave/Classes"),
]
)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ github "bastienFalcou/SoundWave"

Run `$ carthage update` to build the framework and drag the built `SoundWave.framework` into your Xcode project.

### Swift Package Manager

[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code.

In Xcode choose File | Swift Packages | Add package depedency and enter https://github.com/bastienFalcou/SoundWave.

## Usage

Check out the demo app for an example. It contains the following demos: record sound and display metering levels on the fly, play sound afterwards, resize view, change colors and multiple other properties.
Expand Down
20 changes: 19 additions & 1 deletion SoundWave/Classes/AudioVisualizationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AVFoundation
import UIKit

public class AudioVisualizationView: BaseNibView {
public class AudioVisualizationView: UIView {
public enum AudioVisualizationMode {
case read
case write
Expand Down Expand Up @@ -62,6 +62,8 @@ public class AudioVisualizationView: BaseNibView {

private var playChronometer: Chronometer?

private let traversalView = UIView()

public var meteringLevels: [Float]? {
didSet {
if let meteringLevels = self.meteringLevels {
Expand Down Expand Up @@ -92,12 +94,28 @@ public class AudioVisualizationView: BaseNibView {

override public init(frame: CGRect) {
super.init(frame: frame)

setup()
}

required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

setup()
}

private func setup() {
traversalView.translatesAutoresizingMaskIntoConstraints = false
addSubview(traversalView)

NSLayoutConstraint.activate([
traversalView.heightAnchor.constraint(equalToConstant: 1),
traversalView.leadingAnchor.constraint(equalTo: leadingAnchor),
traversalView.trailingAnchor.constraint(equalTo: trailingAnchor),
traversalView.centerYAnchor.constraint(equalTo: centerYAnchor)
])
}

override public func draw(_ rect: CGRect) {
super.draw(rect)

Expand Down
35 changes: 0 additions & 35 deletions SoundWave/Classes/AudioVisualizationView.xib

This file was deleted.

91 changes: 0 additions & 91 deletions SoundWave/Classes/BaseNibView.swift

This file was deleted.