Thank you for visiting our account. We are going to make a speech app in an hour. If would you like to study yourself before hands-on, or review what you have learned in the session, please use the following material.
We are providing free hands-on on a monthly basis
https://www.meetup.com/iOS-Development-Meetup-for-Beginner/
We also hold face-to-face or group lesson for individual interested in making iOS app themselves
http://ios-class-for-beginner.esy.es/
Xcode 8.3.2 / Swift 3
0-1. Open Xcode
0-2. Select "Create a new Xcode project"
0-3. Select "Single View Application" and then tap "Next"
0-4. Fill "Product name" and then tap "Next"
0-5. Select the place for saving your project and then tap "Create"
・Microphone icon1-1. Drop your icon into your "Assets.xcassets"
2-1. Drap & Drop "UITextView"
2-2. Resize "UITextView". After that, set "Autoresizing" for adjusting frame depending on devices
2-3. Replace text of "UITextView"
2-4. Drap & Drop "UIButton"
2-5. Set "UIButton" image
2-6. Resize "UIButton". Set "Autoresizing"
★ control + drag in storyboard to create a control segue
3-1. Connect "UITextView"
3-2. Add action of "UIButton"
★ It's preferable to write following code yourself. It will help you to understand code more.
import UIKit
import AVFoundation // Import AVFoundation to access speech fearure
class ViewController: UIViewController
{
@IBOutlet var txtv: UITextView!
var synthesizer = AVSpeechSynthesizer()
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func tappedSpeech(_ sender: Any)
{
// Create contents
let contents = AVSpeechUtterance(string: txtv.text ?? "")
// Set language
contents.voice = AVSpeechSynthesisVoice(language: "en-US")
// Speak
synthesizer.speak(contents)
}
}