From 605051e11795ad95e203d295da82b0e1976674ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 Aug 2025 15:28:29 +0000 Subject: [PATCH 01/10] Initial plan From b71f1dc353dc6efb0e6f8ce56772bf2ca7171792 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 Aug 2025 15:35:50 +0000 Subject: [PATCH 02/10] Set up GitHub Actions testing and improve tests Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com> --- .github/workflows/test.yml | 34 +++++++++++ CONTRIBUTING.md | 2 +- README.md | 10 ++-- .../FDWaveformViewTests.swift | 60 +++++++++++++++++-- 4 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dcf31b6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +--- +name: Test + +"on": + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Select Xcode version + run: > + sudo xcode-select -s + /Applications/Xcode_15.4.app/Contents/Developer + + - name: Build + run: swift build + + - name: Run tests + run: swift test + + - name: Build for iOS Simulator + run: | + xcodebuild -scheme FDWaveformView \ + -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \ + build \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3fc367b..f04bfce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ All contributors are welcome. Please use issues and pull requests to contribute # Release Process -1. Confirm the build vorks (todo: set up GitHub Actions testing) +1. Confirm the build works (GitHub Actions testing is now set up and will validate builds) 2. Create a release commit, see [prior releases](https://github.com/fulldecent/FDWaveformView/releases) for an example 1. Update the change log to label the latest improvements under the new version name 2. Update the podspec version number diff --git a/README.md b/README.md index 1ce35cd..bb80a8e 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ Features **Set play progress** to highlight part of the waveform: ```swift -self.waveform.progressSamples = self.waveform.totalSamples / 2 +let samplesToHighlight = self.waveform.totalSamples / 2 +self.waveform.highlightedSamples = 0 ..< samplesToHighlight ```
@@ -35,8 +36,7 @@ self.waveform.progressSamples = self.waveform.totalSamples / 2 **Zoom in** to show only part of the waveform, of course, zooming in will smoothly re-render to show progressively more detail: ```swift -self.waveform.zoomStartSamples = 0 -self.waveform.zoomEndSamples = self.waveform.totalSamples / 4 +self.waveform.zoomSamples = 0 ..< (self.waveform.totalSamples / 4) ```
@@ -60,7 +60,7 @@ self.waveform.doesAllowScroll = true
```swift
UIView.animate(withDuration: 0.3) {
let randomNumber = arc4random() % self.waveform.totalSamples
- self.waveform.progressSamples = randomNumber
+ self.waveform.highlightedSamples = 0 ..< randomNumber
}
```
@@ -73,7 +73,7 @@ Creates **antialiased waveforms** by drawing more pixels than are seen on screen
Supports **iOS12+** and Swift 5.
-**Includes unit tests**, todo: run these on GitHub Actions
+**Includes unit tests**, now running on GitHub Actions
## Installation
diff --git a/Tests/FDWaveformViewTests/FDWaveformViewTests.swift b/Tests/FDWaveformViewTests/FDWaveformViewTests.swift
index 0f21646..cb8242f 100644
--- a/Tests/FDWaveformViewTests/FDWaveformViewTests.swift
+++ b/Tests/FDWaveformViewTests/FDWaveformViewTests.swift
@@ -2,11 +2,59 @@ import XCTest
@testable import FDWaveformView
final class FDWaveformViewTests: XCTestCase {
- func testExample() throws {
- // XCTest Documentation
- // https://developer.apple.com/documentation/xctest
-
- // Defining Test Cases and Test Methods
- // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
+
+ func testFDWaveformViewInitialization() throws {
+ // Test that FDWaveformView can be initialized
+ let waveformView = FDWaveformView()
+ XCTAssertNotNil(waveformView)
+ XCTAssertEqual(waveformView.totalSamples, 0)
+ XCTAssertNil(waveformView.audioURL)
+ XCTAssertNil(waveformView.highlightedSamples)
+ XCTAssertEqual(waveformView.zoomSamples, 0..<0)
+ }
+
+ func testFDWaveformViewProperties() throws {
+ // Test that properties can be set and retrieved
+ let waveformView = FDWaveformView()
+
+ // Test boolean properties
+ waveformView.doesAllowScrubbing = false
+ XCTAssertFalse(waveformView.doesAllowScrubbing)
+
+ waveformView.doesAllowStretch = false
+ XCTAssertFalse(waveformView.doesAllowStretch)
+
+ waveformView.doesAllowScroll = false
+ XCTAssertFalse(waveformView.doesAllowScroll)
+
+ // Test color properties
+ waveformView.wavesColor = .red
+ XCTAssertEqual(waveformView.wavesColor, .red)
+
+ waveformView.progressColor = .green
+ XCTAssertEqual(waveformView.progressColor, .green)
+ }
+
+ func testFDWaveformTypeEquality() throws {
+ // Test FDWaveformType enum equality
+ let linear1 = FDWaveformType.linear
+ let linear2 = FDWaveformType.linear
+ let logarithmic1 = FDWaveformType.logarithmic(noiseFloor: -50.0)
+ let logarithmic2 = FDWaveformType.logarithmic(noiseFloor: -50.0)
+ let logarithmic3 = FDWaveformType.logarithmic(noiseFloor: -60.0)
+
+ XCTAssertEqual(linear1, linear2)
+ XCTAssertEqual(logarithmic1, logarithmic2)
+ XCTAssertNotEqual(linear1, logarithmic1)
+ XCTAssertNotEqual(logarithmic1, logarithmic3)
+ }
+
+ func testFDWaveformTypeFloorValue() throws {
+ // Test floor value property
+ let linear = FDWaveformType.linear
+ let logarithmic = FDWaveformType.logarithmic(noiseFloor: -45.0)
+
+ XCTAssertEqual(linear.floorValue, 0)
+ XCTAssertEqual(logarithmic.floorValue, -45.0)
}
}
From 415952a24d9ed630356a817b2d18f0f1382307ed Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 13 Aug 2025 15:36:36 +0000
Subject: [PATCH 03/10] Add recommendations for additional helpful work
Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>
---
RECOMMENDATIONS.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 RECOMMENDATIONS.md
diff --git a/RECOMMENDATIONS.md b/RECOMMENDATIONS.md
new file mode 100644
index 0000000..6fc1a33
--- /dev/null
+++ b/RECOMMENDATIONS.md
@@ -0,0 +1,72 @@
+# Recommendations for Additional Work
+
+Based on the open issues in this repository, here are some recommended improvements that could be implemented:
+
+## High Priority Issues
+
+### Issue #157: Example app functionality issues
+- The example project toggles don't work in simulator
+- Zooming in/out doesn't function properly
+- Needs investigation and fixes to ensure examples work correctly
+
+### Issue #156: visionOS Support
+- `tracks(withMediaType:)` is unavailable in visionOS
+- Consider adding conditional compilation for visionOS platform
+- Alternative: Use newer AVFoundation APIs that work across platforms
+
+### Issue #148: ✅ COMPLETED - Updated README examples
+- Fixed outdated API usage in README examples
+- Changed `progressSamples` to `highlightedSamples`
+- Changed `zoomStartSamples`/`zoomEndSamples` to `zoomSamples` range
+
+## Medium Priority Enhancements
+
+### Issue #146: Separate rendering from display
+- Consider architectural changes to separate rendering logic from UI
+- Could improve performance and enable server-side rendering
+- Reference competitor: DSWaveformImage library
+- Would enable gradient and "lo-fi" bar rendering styles
+
+### Issue #139: View and data provider separation
+- Define protocol for data sources beyond AVAsset
+- Remove AVFoundation dependency from core view logic
+- Enable custom data sources (e.g., generated sine waves, network streams)
+- Substantial architectural change but would improve flexibility
+
+### Issue #130: Audio playback integration examples
+- Currently blocked on Issue #139
+- Need clear examples of connecting waveform progress to audio playback
+- Would greatly improve developer experience
+
+## Lower Priority Issues
+
+### Issue #153: Custom wave styling
+- User wants custom waveform shapes/styles
+- Could be addressed as part of the rendering separation work
+
+### Issue #104: Prevent scrolling past audio end
+- Add option to keep waveform end at right edge when zoomed
+- Relatively simple UX improvement
+
+### Issue #96: Consider UIScrollView subclassing
+- Would add scroll-past-ends, bouncing, acceleration
+- API non-breaking change that adds many gesture features
+
+### Issue #93: Zoom crash protection
+- Add maximum zoom limits to prevent crashes
+- Simple safety feature with hardcoded limits
+
+### Issue #2: Incremental rendering
+- Update view progressively for large files instead of all-at-once
+- Performance improvement for large audio files
+
+## Implementation Priority Recommendations
+
+1. **Fix Example App (Issue #157)** - Critical for developer onboarding
+2. **Add visionOS Support (Issue #156)** - Platform compatibility
+3. **Audio Integration Examples (Issue #130)** - After Issue #139 resolution
+4. **Zoom Safety (Issue #93)** - Simple safety improvement
+5. **Scroll Behavior (Issue #104)** - UX improvement
+6. **Architectural Refactoring (Issues #139, #146)** - Long-term improvements
+
+The GitHub Actions setup and test improvements completed in this PR provide a solid foundation for implementing these enhancements with confidence.
\ No newline at end of file
From 48acf4a929938fa0a73beda9851dd67c9fbfc8d6 Mon Sep 17 00:00:00 2001
From: William Entriken