Automated Mock Generation for Swift Protocols
swiftmock.com·7h·
Discuss: Hacker News
📡Protocol Design
Preview
Report Post

Swift 6.1 macOS 13+ MIT License

Stop writing mocks.

Start testing.

SwiftMock automatically generates mock implementations for your Swift protocols. Mark protocols with /// @mockable and let SwiftMock handle the boilerplate.

$ swiftmock –source ./Sources –output ./Tests/Mocks/GeneratedMocks.swift▋

✓ Found 12 mockable protocols

✓ Generated mocks in 0.3s

Time Consuming

Hours spent writing boilerplate mock code instead of actual tests

🔄

Repetitive Work

Same patterns repeated across every protocol in your codebase

⚠️

Error Prone

Manual mock updates often fall out of sync with protocol changes

The Solution

Automatic mock generation

SwiftMock scans your Swift source files, finds protocols marked with /// @mockable, and generates complete mock im…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help