Idiomatic APIs
Help your agent choose language features and APIs that express the code's intent more clearly.
SwiftFairy Scroll
Refine code for clarity, maintainability, and performance through idiomatic use of modern Swift APIs, including modern Swift concurrency and collection processing.
Help your agent choose language features and APIs that express the code's intent more clearly.
Give your agent guidance on concurrency API choices and how to apply modern Swift conventions.
Identify incorrect indexing and unnecessary processing so your agent can work with collections more safely and efficiently.
Modern Swift flags over 60 issues in your code. Each finding arrives at the line where the issue occurs, with the guidance and code example written for that case.
Your agent skips millions of tokens of reasoning and reads guidance only for the issues flagged.
Built on our books and articles, and Natalia's work on Apple's SwiftUI team.
These examples show the patterns SwiftFairy flags and the guidance your agent can use to address them. Highlighted lines mark the code to review; each finding indicates whether the guidance is a requirement, recommendation, or consideration.
Should
When only the number of matching elements is needed, filtering an array creates an unnecessary intermediate array. count(where:) counts the matches directly.
let temperatures = [-5, 10, -2, 20, 25, -1]
let warmDays = temperatures.filter {
$0 > 0
}.count
let temperatures = [-5, 10, -2, 20, 25, -1]
let warmDays = temperatures.count {
$0 > 0
}
count(where:) returns the same result without allocating an intermediate array. It requires a Swift 6 compiler.
Consider
When finding a result should end both nested loops, a labeled break can exit the outer loop directly. This avoids a flag whose only purpose is to communicate that the search has finished.
var stop = false
for row in matrix {
for value in row {
if value == 5 {
print(value)
stop = true
break
}
}
if stop {
break
}
}
search: for row in matrix {
for value in row {
if value == 5 {
print(value)
break search
}
}
}
The labelled break exits both loops without temporary state. Use it when the flag has no other purpose and exiting directly preserves the work performed before leaving the loops.
…and over 60 other issues.
Ask your agent to review a code change or a complete codebase with SwiftFairy. Your agent uses the findings and their accompanying code examples to resolve issues in your code.
How to use SwiftFairyActivate your free trial within the app at any time.
Choose lifetime access, a fixed term, or a subscription for this Scroll, or get all four together in a bundle.
Correct subtle bugs and performance issues in data flow, state ownership, and view updates by using SwiftUI as it was designed to be used.
Build interfaces that adapt to any window size, device, and text size by sizing views flexibly, structuring scrolling content correctly, and choosing the right SwiftUI layout API for each job.
Improve rendering and interaction performance by structuring charts and surrounding views to limit unnecessary updates and use Swift Charts APIs effectively.