Accessibility iOS SwiftUI

Introduction Previously, I posted about Accessibility for UIKit. The idea behind this post is to find differences between UIKit Accessibility and SwiftUI features. Similarities: Both UIKit and SwiftUI have accessibilityLabel and accessibilityHints APIs. Differences: To use dynamic type for fonts, you need additional modifiers in SwiftUI. struct ScaledFont: ViewModifier { @Environment(\.sizeCategory) var sizeCategory var name: String var size: Double func body(content: Content) -> some View { let scaledSize = UIFontMetrics.default.scaledValue(for: size) return content....

June 2, 2024 · 3 min · Dmytro Chumakov

Accessibility iOS UIKit

Introduction I was curious to find out how to make an application more accessible. You can look at popular applications like YouTube or Netflix; they all have accessibility features like VoiceOver and dynamic fonts. I decided to create this example for a fruit calorie counter. It contains a list of fruits with the fruit name, fruit calories, and a favorite button. Where to Start Before diving into implementation details, I want to highlight some information about the existing accessibility features and what I will be focusing on....

May 30, 2024 · 3 min · Dmytro Chumakov

Text To Speech iOS

Introduction I was eager to learn how converting Text To Speech works in iOS. Here is what I discovered: First Step The first step is to add AVSpeechSynthesizer, an object that produces synthesized speech from text utterances. @State private var speechSynthesizer = AVSpeechSynthesizer() Second Step The second step is to add AVSpeechUtterance, an object that encapsulates the text for speech synthesis. private var utterance: AVSpeechUtterance { let inputMessage = "Hello world!...

May 24, 2024 · 1 min · Dmytro Chumakov

Speech To Text iOS

Introduction I always wanted an iOS app that would allow me to economize my time by converting speech to text. I know this option is built into the keyboard, but you first need to click the text field, then tap on the microphone, and finally speak. I wanted a one-click option with the possibility to integrate it into all my daily routines. Here is what I discovered: First Step The first step is to request authorization to access the device’s microphone using the Privacy - Speech Recognition Usage Description key and the Privacy - Microphone Usage Description key....

May 23, 2024 · 4 min · Dmytro Chumakov

Animation - UIKit

Introduction I was curious about creating animations in UIKit. I wanted to animate different properties such as color and path. Here is what I found: It’s impossible to create complex animations only by using the block-based animation API. To do that, you need the Core Animation API and CAPropertyAnimation with its various subclasses. Complex animation in UIKit is based on a few key components: CAShapeLayer - provides extensive customization options: path, stroke, fill, shadow CABasicAnimation - helps animate color or change the path Implementation First Step The first step is to create a shape layer that will draw an arrow using CAShapeLayer....

May 21, 2024 · 2 min · Dmytro Chumakov