Skip to content

Commit 685b044

Browse files
committed
Reduce public API
1 parent a1637e3 commit 685b044

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

Example/Source/ViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,17 @@ class ViewController: UIViewController {
108108
}
109109

110110
@IBAction func doLinear() {
111+
/* TODO: Make this public and then use it here
111112
waveform.waveformType = .linear
112113
updateWaveformTypeButtons()
114+
*/
113115
}
114116

115117
@IBAction func doLogarithmic() {
118+
/* TODO: Make this public and then use it here
116119
waveform.waveformType = .logarithmic
117120
updateWaveformTypeButtons()
121+
*/
118122
}
119123

120124
@IBAction func doChangeColors() {
@@ -142,6 +146,7 @@ class ViewController: UIViewController {
142146
}
143147

144148
func updateWaveformTypeButtons() {
149+
/* TODO: Make this public and then use it here
145150
let (selectedButton, nonSelectedButton): (UIButton, UIButton) = {
146151
switch waveform.waveformType {
147152
case .linear: return (linearButton, logarithmicButton)
@@ -151,6 +156,7 @@ class ViewController: UIViewController {
151156
selectedButton.layer.borderColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 0.25).cgColor
152157
selectedButton.layer.borderWidth = 2
153158
nonSelectedButton.layer.borderWidth = 0
159+
*/
154160
}
155161
}
156162

Source/FDWaveformRenderOperation.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
// Copyright 2013 - 2017, William Entriken and the FDWaveformView contributors.
33
//
44
import UIKit
5+
import AVFoundation
6+
import Accelerate
57

68
/// Format options for FDWaveformRenderOperation
7-
public struct FDWaveformRenderFormat {
9+
//MAYBE: Make this public
10+
struct FDWaveformRenderFormat {
811

912
/// The type of waveform to render
10-
public var type: FDWaveformType
13+
//TODO: make this public after reconciling FDWaveformView.WaveformType and FDWaveformType
14+
var type: FDWaveformType
1115

1216
/// The color of the waveform
1317
public var wavesColor: UIColor
@@ -30,7 +34,7 @@ public struct FDWaveformRenderFormat {
3034
scale: UIScreen.main.scale)
3135
}
3236

33-
public init(type: FDWaveformType, wavesColor: UIColor, scale: CGFloat) {
37+
init(type: FDWaveformType, wavesColor: UIColor, scale: CGFloat) {
3438
self.type = type
3539
self.wavesColor = wavesColor
3640
self.scale = scale
@@ -50,7 +54,7 @@ final public class FDWaveformRenderOperation: Operation {
5054
public let sampleRange: CountableRange<Int>
5155

5256
/// Format of waveform image
53-
public let format: FDWaveformRenderFormat
57+
let format: FDWaveformRenderFormat
5458

5559
// MARK: - NSOperation Overrides
5660

Source/FDWaveformView.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ open class FDWaveformView: UIView {
9292
/*@IBInspectable*/ open var doesAllowScroll = true
9393

9494
/// Supported waveform types
95-
public enum WaveformType {
95+
//TODO: make this public after reconciling FDWaveformView.WaveformType and FDWaveformType
96+
enum WaveformType {
9697
case linear, logarithmic
9798
}
9899

99100
// Type of waveform to display
100-
open var waveformType: WaveformType = .logarithmic {
101+
var waveformType: WaveformType = .logarithmic {
101102
didSet {
102103
setNeedsDisplay()
103104
setNeedsLayout()
@@ -198,7 +199,8 @@ open class FDWaveformView: UIView {
198199
}
199200

200201
/// Waveform type for rending waveforms
201-
public var waveformRenderType: FDWaveformType {
202+
//TODO: make this public after reconciling FDWaveformView.WaveformType and FDWaveformType
203+
var waveformRenderType: FDWaveformType {
202204
get {
203205
switch waveformType {
204206
case .linear: return .linear
@@ -434,7 +436,8 @@ open class FDWaveformView: UIView {
434436
}
435437
}
436438

437-
public enum FDWaveformType: Equatable {
439+
//TODO: make this public after reconciling FDWaveformView.WaveformType and FDWaveformType
440+
enum FDWaveformType: Equatable {
438441
/// Waveform is rendered using a linear scale
439442
case linear
440443

@@ -457,14 +460,14 @@ public enum FDWaveformType: Equatable {
457460
return false
458461
}
459462

460-
fileprivate var floorValue: CGFloat {
463+
public var floorValue: CGFloat {
461464
switch self {
462465
case .linear: return 0
463466
case .logarithmic(let noiseFloor): return noiseFloor
464467
}
465468
}
466469

467-
fileprivate func process(normalizedSamples: inout [Float]) {
470+
func process(normalizedSamples: inout [Float]) {
468471
switch self {
469472
case .linear:
470473
return

0 commit comments

Comments
 (0)