Skip to content

Commit 53b2081

Browse files
committed
Add public initializers to FDWaveformRenderFormat.
1 parent ba3ca8b commit 53b2081

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

Source/FDWaveformView.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,20 +541,34 @@ public enum FDWaveformType: Equatable {
541541
public struct FDWaveformRenderFormat {
542542

543543
/// The type of waveform to render
544-
public var type: FDWaveformType = .linear
544+
public var type: FDWaveformType
545545

546546
/// The color of the waveform
547-
public var wavesColor = UIColor.black
547+
public var wavesColor: UIColor
548548

549549
/// The scale factor to apply to the rendered image (usually the current screen's scale)
550-
public var scale: CGFloat = UIScreen.main.scale
550+
public var scale: CGFloat
551551

552552
/// Whether the resulting image size should be as close as possible to imageSize (approximate)
553553
/// or whether it should match it exactly. Right now there is no support for matching exactly.
554554
// TODO: Support rendering operations that always match the desired imageSize passed in.
555555
// Right now the imageSize passed in to the render operation might not match the
556556
// resulting image's size. This flag is hard coded here to convey that.
557557
public let constrainImageSizeToExactlyMatch = false
558+
559+
// To make these public, you must implement them
560+
// See http://stackoverflow.com/questions/26224693/how-can-i-make-public-by-default-the-member-wise-initialiser-for-structs-in-swif
561+
public init() {
562+
self.init(type: .linear,
563+
wavesColor: .black,
564+
scale: UIScreen.main.scale)
565+
}
566+
567+
public init(type: FDWaveformType, wavesColor: UIColor, scale: CGFloat) {
568+
self.type = type
569+
self.wavesColor = wavesColor
570+
self.scale = scale
571+
}
558572
}
559573

560574
/// Operation used for rendering waveform images

0 commit comments

Comments
 (0)