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 Date: Wed, 13 Aug 2025 15:29:57 -0400 Subject: [PATCH 04/10] Delete RECOMMENDATIONS.md --- RECOMMENDATIONS.md | 72 ---------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 RECOMMENDATIONS.md diff --git a/RECOMMENDATIONS.md b/RECOMMENDATIONS.md deleted file mode 100644 index 6fc1a33..0000000 --- a/RECOMMENDATIONS.md +++ /dev/null @@ -1,72 +0,0 @@ -# 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 f761f114be136ca5eeb9990a0b5978d22a895283 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 Aug 2025 21:13:12 +0000 Subject: [PATCH 05/10] Fix GitHub Actions workflow for macOS/iOS builds and add platform specs to Package.swift Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com> --- .github/workflows/test.yml | 21 ++++++++------------- Package.swift | 4 ++++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dcf31b6..2af7514 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,26 +9,21 @@ name: Test jobs: test: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v4 - - name: Select Xcode version - run: > - sudo xcode-select -s - /Applications/Xcode_15.4.app/Contents/Developer + - name: Setup Xcode version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.4' - - name: Build + - name: Build for macOS 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 + - name: Build for iOS + run: swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios12.0-simulator" diff --git a/Package.swift b/Package.swift index 5c6eba0..1522a73 100644 --- a/Package.swift +++ b/Package.swift @@ -5,6 +5,10 @@ import PackageDescription let package = Package( name: "FDWaveformView", + platforms: [ + .iOS(.v12), + .macOS(.v10_14) + ], products: [ // Products define the executables and libraries a package produces, making them visible to other packages. .library( From 192cda0bee31cd9427090119568daa9529affc91 Mon Sep 17 00:00:00 2001 From: William Entriken Date: Wed, 13 Aug 2025 17:24:36 -0400 Subject: [PATCH 06/10] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2af7514..d32fba8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Xcode version uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.4' + xcode-version: '15.2' - name: Build for macOS run: swift build From 8794905401156aaeacee1192262e848e802b2e42 Mon Sep 17 00:00:00 2001 From: William Entriken Date: Wed, 13 Aug 2025 17:32:00 -0400 Subject: [PATCH 07/10] get macos14 / xcode 15.4 --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d32fba8..5c9fc20 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ name: Test jobs: test: - runs-on: macos-13 + runs-on: macos-14 steps: - uses: actions/checkout@v4 @@ -17,7 +17,7 @@ jobs: - name: Setup Xcode version uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.2' + xcode-version: '15.4' - name: Build for macOS run: swift build From b9086956555f3f92a3b41708cd8a7574202b5b13 Mon Sep 17 00:00:00 2001 From: William Entriken Date: Wed, 13 Aug 2025 17:39:42 -0400 Subject: [PATCH 08/10] Update test.yml --- .github/workflows/test.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c9fc20..8de5c09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ --- name: Test -"on": +on: push: branches: [main, master] pull_request: @@ -19,11 +19,5 @@ jobs: with: xcode-version: '15.4' - - name: Build for macOS - run: swift build - - - name: Run tests - run: swift test - - name: Build for iOS run: swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios12.0-simulator" From c76428920e7158c20c21d22116c2e10c5d902d85 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:18:21 +0000 Subject: [PATCH 09/10] Fix GitHub Actions to target iPhone platform instead of macOS Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com> --- .github/workflows/test.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8de5c09..94355b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,5 +19,14 @@ jobs: with: xcode-version: '15.4' - - name: Build for iOS - run: swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios12.0-simulator" + - name: Build and Test for iOS + run: | + # Build for iPhone Simulator using xcodebuild with Swift package + xcodebuild -scheme FDWaveformView \ + -destination "platform=iOS Simulator,name=iPhone 15,OS=17.5" \ + clean build + + # Run tests on iPhone Simulator + xcodebuild -scheme FDWaveformView \ + -destination "platform=iOS Simulator,name=iPhone 15,OS=17.5" \ + test From d23b9f68891cf7374336062ff98457da9d37ccbb Mon Sep 17 00:00:00 2001 From: William Entriken Date: Thu, 14 Aug 2025 11:36:58 -0400 Subject: [PATCH 10/10] remove unused path --- Example/Example.xcodeproj/project.pbxproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index f824a82..2552895 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -291,7 +291,6 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"Sources/Preview Content\""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -319,7 +318,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"Sources/Preview Content\""; + DEVELOPMENT_TEAM = 8Q693ZG5RN; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;