Skip to content

Remove swift-snapshot-testing dependency#9

Merged
jcavar merged 2 commits intofeature/licensefrom
feature/no-dependencies
Dec 10, 2025
Merged

Remove swift-snapshot-testing dependency#9
jcavar merged 2 commits intofeature/licensefrom
feature/no-dependencies

Conversation

@jcavar
Copy link
Collaborator

@jcavar jcavar commented Nov 28, 2025

I've been thinking about this for a while, but I've decided to do it in the end for several reasons:

  • It would be quite difficult to get all these changes in swift-snapshot-testing
  • Comparing images on different platforms is a difficult task
  • Our new approach of having a snapshot in one format and visualisation in another format is not compatible with snapshot testing library
  • Fewer dependencies

@@ -0,0 +1,8 @@
/// Specifies the amplitude scaling method for spectrograms.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was existing type, just extracted it to a separate file.

@@ -0,0 +1,37 @@
/// Defines the visualization strategy for audio snapshot failures.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches strategies that we previously had. Just extracted as an enum now as they are not Snapshotting extensions.

/// - height: The height of the resulting image.
/// - window: Optional window function for FFT. Uses Hann window if not provided.
/// - threshold: Minimum amplitude threshold for frequency bins. Defaults to `0.005`.
/// - Note: Requires iOS 16+ or macOS 13+.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now a runtime check instead of making all of this iOS 16 dependent. This feels more reasonable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does runtime check mean that fatalError if user runs this on lower iOS version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@@ -0,0 +1,13 @@
import SwiftUI
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing typealias-es extracted to a separate file

@jcavar jcavar force-pushed the feature/no-dependencies branch 4 times, most recently from 52ed702 to e8c6e2f Compare November 29, 2025 13:27
}

private var xAxisValues: [String] {
guard !data.isEmpty else { return [] }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data[0] was crashing for empty data down below

@jcavar jcavar force-pushed the feature/no-dependencies branch 6 times, most recently from f06cc62 to 6b68edd Compare December 4, 2025 10:43
@jcavar jcavar force-pushed the feature/no-dependencies branch from 6b68edd to bb7de74 Compare December 4, 2025 13:56
@jcavar jcavar marked this pull request as ready for review December 4, 2025 13:57
@jcavar jcavar requested a review from hhrvoic December 4, 2025 13:57
@jcavar jcavar merged commit cf95ed0 into feature/license Dec 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants