Переводчик

Январь 8, 2019  · 2 мин. чтения


Programming language: Swift 4.2
Integrated development environment: Xcode 10
Using: CoreData, Speech, MVP architecture
Testing: iPhone 8 Plus (Not a simulator)
GitHub: Translate


The application allows you to translate the text from Russian to English, and from English to Russian.

Setting up the iOS Project


Note: This application does not work correctly when using the hardware keyboard. If you are testing this app in a simulator, you should disable the hardware keyboard. Hardware -> Keyboard -> Remove the check mark Connect Hardware Keyboard

  1. Download the Translate project source. You can do this either by forking and cloning the repository or by downloading it as a ZIP file and extracting it.

  2. Open Translate.xcodeproj from the folder.

  3. Change the value of the variable userKey in APIModel.swift using your API key. Get your own key.

  4. Build the project (⌘ + B) and check for any errors.

  5. Run the app (⌘ + R).

Application features


The application supports CoreData. This feature allows to save user translations.

The functionality includes two text input modes.

  1. Voice input – to use this input method, you must click on the microphone icon. After entering the text by voice, you need to press the send button to get the translation.

After the voice recording starts, the timer starts for 5 seconds. If during this time the microphone does not record the voice, the recording will stop automatically.

After the end of speech, the timer starts for 2 seconds, which determines the end of speech and stop recording.

  1. Keyboard input – to enter text manually, you must click on the text input field and start typing text using the application built-in keyboard.

Added a long press feature that allows you to share or copy translation.

You can also delete any translation using long press feature.