AI-AccessibilityKit is a Swift package designed to make iOS apps more inclusive by leveraging Core ML, Vision, and SwiftUI. It automates accessibility audits and enhancements, helping developers deliver WCAG-compliant, VoiceOver-friendly, and Dynamic Type-ready experiences.
-
Auto VoiceOver Labels
Automatically generate accessibility labels for images and icons using:- Core ML image classification
- Vision OCR for text detection
-
Dynamic Font Scaling
Apply adaptive font sizes for better readability across all Dynamic Type settings. -
Color Contrast Audit
Real-time WCAG 2.1 contrast ratio checks with visual badges in previews. -
Touch Target Audit
Highlights UI elements smaller than Apple’s recommended 44pt minimum. -
Real-Time Accessibility Overlay
Adds a 44pt grid and audit badges in Xcode Previews for proactive design checks.
Add AI-AccessibilityKit to your project using Swift Package Manager:
- In Xcode, go to File → Add Packages…
- Enter the repository URL:
https://github.com/Mulla6518/AI-AccessibilityKit.git
- Select Add Package and link it to your app target.
import SwiftUI
import AIAccessibilityKit
Image(systemName: "leaf.fill")
.autoVoiceOverLabel() // AI-generated label via Core ML + VisionText("Eco Rewards")
.dynamicFont(.title3) // Automatically scales for accessibility sizesVStack {
Text("Accessible Text")
}
.auditContrast(foreground: .primary, background: .white)Button("Continue") { }
.auditTouchTarget() // Highlights if < 44pt#Preview {
AccessibleCard()
.modifier(AccessibilityAuditOverlay(showGrid: true))
}struct AccessibleCard: View {
var body: some View {
VStack(spacing: 12) {
Image(systemName: "leaf.fill")
.autoVoiceOverLabel()
.auditTouchTarget()
Text("Eco Rewards")
.dynamicFont(.title3)
Text("Earn points for sustainable purchases.")
.dynamicFont(.body)
Button("Continue") { }
.padding()
.background(.blue)
.foregroundStyle(.white)
.clipShape(Capsule())
.autoVoiceOverLabel()
.auditTouchTarget()
}
.padding()
.background(.white)
.clipShape(RoundedRectangle(cornerRadius: 16))
.auditContrast(foreground: .primary, background: .white)
.modifier(AccessibilityAuditOverlay(showGrid: true))
}
}✅ Requirements
- iOS 18+
- Xcode 16+
- Core ML model (e.g., ImageClassifier.mlmodel) for image labeling
📖 How It Works
- Core ML + Vision: Snapshots SwiftUI views, runs OCR and image classification to suggest labels.
- SwiftUI Modifiers: Apply accessibility audits without changing your existing layout.
- Previews Integration: Visualize audits in real-time during development.
🔍 Roadmap
- ✅ Auto VoiceOver labels
- ✅ WCAG contrast audits
- ✅ Touch target checks
- 🔜 Localization-aware AI labels
- 🔜 Snapshot-based accessibility reports for CI/CD
🤝 Contributing Contributions are welcome!
- Fork the repo
- Create a feature branch
- Submit a pull request
📄 License MIT License. See LICENSE for details.