This iOS application built with SwiftUI that simulates a āpet translatorā experience.
- The Translator screen allows the user to start recording speech (with a microphone button), simulates a recording process, and then shows a mock translation result.
- The Clicker screen displays various settings (Rate Us, Share App, Contact Us, etc.) in a list-like format.
- Xcode 14 or later
- iOS 14 or later
- Swift 5
- SwiftUI
- Clone or download this repository.
- Open the project in Xcode (
PetTranslator.xcodeproj
). - Select an iOS simulator or a real device.
- Build and run the project (
Cmd + R
in Xcode).
- PetTranslatorApp.swift: The entry point of the app.
- ContentView.swift: Contains a custom bottom navigation bar with two main tabs (Translator & Clicker).
- TranslatorView.swift: The main screen for recording and simulating a pet translation.
- ResultView.swift: Displays the mock translation result after the recording process.
- ClickerView.swift: Shows the settings list (Rate Us, Share, etc.).
- Launch the app.
- Tap on Translator to access the main translator screen.
- Press Start Speak to simulate recording; after a few seconds, it will automatically navigate to a ātranslatingā process and then display a Result screen.
- Return to the main screen or switch to Clicker to view the settings page.
import SwiftUI
struct TranslatorView: View {
@State private var isRecording = false
var body: some View {
VStack {
Text("Translator")
.font(.largeTitle)
if isRecording {
Text("Recording...")
} else {
Button("Start Speak") {
startRecording()
}
}
}
}
func startRecording() {
isRecording = true
// Simulate a 3-second recording
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
isRecording = false
// Navigate to the Result screen...
}
}
}