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!" let utterance = AVSpeechUtterance(string: inputMessage) utterance.voice = AVSpeechSynthesisVoice(language: "en-US") return utterance } Optional You can configure pitch, rate, and voice parameters. ...

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: ...

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

Animation - SwiftUI

Introduction I was eager to learn about creating complex animations in SwiftUI. The few questions that were on my mind included what types of animations exist and what I can animate. Here is what I found: Types of Animation SwiftUI has explicit and implicit animation types. Implicit Animation: This is specified with the .animation() modifier. SwiftUI will animate changes in old and new values. struct ImplicitAnimation: View { @State private var half = false @State private var dim = false var body: some View { Image("tower") .scaleEffect(half ? 0.5 : 1.0) .opacity(dim ? 0.2 : 1.0) .animation(.easeInOut(duration: 1.0)) .onTapGesture { self.dim.toggle() self.half.toggle() } } } ...

May 17, 2024 · 2 min · Dmytro Chumakov

Implementing GraphQL in an iOS application

Introduction I previously never had a chance to work with GraphQL. I was excited to learn when to apply this technology, what tools I can use, and how I can implement it. Here’s what I found: For testing, I used the Star Wars GraphQL API with AllFilmsQuery: query AllFilmsQuery { allFilms { films { title director created producers releaseDate } } } I requested allFilms with title, director, created, producers, and releaseDate information. ...

May 15, 2024 · 3 min · Dmytro Chumakov