PDF/WebPages Reader with embedded Google Translate and voice engine on SwiftUI, Combine, Catalyst, AppKit
This project utilizes the following technologies: SwiftUI, Combine, Catalyst and others new features on iOS, ipadOS, macOS that annonced at WWDC 2019
I started this project when SwiftUI was in beta 1 in 2019, so it’s possible that there may be some bugs with memory leaks and the architecture is not perfect. However, there are useful features that you can incorporate into your own projects. You can use this project as it is to learn and practice a foreign language, and to deepen your understanding of articles and WWDC videos. Unfortunately, I don’t currently have the time to fix and rewrite the project, but I plan to add new features in the future.
Swift, Xcode разработка под iOS, macOS
CocoaHeads Chat
The Swift Developers|Сообщество разработчиков
Server Side Swift Developer (SSSD) - russian/ukraine/etc. (сообщество Vapor, Kitura, Perfect, Smoke, Tris)
If you mark this project with ✭. It will allow to easy find this project for other developers. Perhaps they already find more information about SwiftUI, Combine and other WWDC 2019 features in practice.
This project will allow them to get rid of wrong opinion that SwiftUI has a lot of issues and it can not be used in real projects thereby you can bring the time where requests exceed offers.
I created Telegram group https://t.me/ReaderTranslator to support this project.
Where you can ask help questions and offer new features.
Welcome are board.
This project targets to attract attention serious projects to SwiftUI and show its powerful. I develop this project in my free time so it would be imposible to craft such app in a short time if I used UIKit. I also use new features that announced at WWDC 2019 to show how much they are needed in morden apps.
“If you can’t explain it simply, you don’t understand it well enough.”
by Albert Einstein
Since I read a lot of books or articles in a foreign language I periodically turn to Google Translate and Reverso to understand unfamiliar idioms, words or to find a sutable expressions or words in my native language. And I like to listen to how a word or sentence is pronounced through the voice engine of the system or Google Translate and Reverso.
Although this process is simple I would like to make it as more comfortable as possible. Sometimes I am lazy to look into the translator and I make an assumption about the meaning of a word or idiom and it can lead to a missunderstanding which turns into even greater loss of my time.
Another useful feature is to write text in Safari to check and listen to it with a simple selection of text.
** update **
As the project progressed I am not feeling to back to UIKit. Being able to craft a new idea in a few minutes on SwiftUI inspire me to continue developing this project. The ability to concentrate on ideas rather than realizations gives freedom to my creativity.
As I see now this project, when it already has enough useful features that I use every day. Most likely it will be the ecosystem with various services and additional apps that will help you get the language in. The project that helps to avoid the routine while you read, listen and browse info in your chosen language. Everyone can choose own convenient way to get into the foreign language. I like to move forward all time. If I can not do well now I can do it best tomorrow. I like to choose a convenient way to dive into a foreign language. I don’t like to study but I like to explore.
I am going to dive into a new foreign language. I think I will get new ideas for new features to use some foreign language from scratch.
If you want to translate selected text from Safari you should enable ReaderTranslatorSafari extension in Safari preferences
Catalyst project for macOS has some problems:
WKWebView
iOS project seems less useful as it has a small screen to fit 3 views.
iPadOS project takes place to exist but I don’t have iPad now. I going to buy it with a pencil and continue experimenting with usability.
If you want to run the project on macOS I recommend to use ‘ReaderTranslatorMac’ target. I keep to support Catalyst version for macOS but nowadays it has some unfixed issues noted above.
Explore features, limitations and bugs SwiftUI, Combine and Catalyst.
2.2.0
Show subtitles from .srt.
Use the best subtitles generator Whisper
2.1.0
Add ChatGPT View
2.0.0
Translate audio and video sources to text (macOS only, iOS might come in the future)
1.13.0
Implemeted iPadOS target project
1.12.2
Speaking selected words and phrases by Cambridge speakers
1.12.0
1.11.1
1.11.0
1.10.0
1.9.2
1.9.1
1.9.0
1.8.5
Add english.stackexchange.com
1.8.4
AudioPlayer features
1.8.2
1.8.1
1.8.0
1.7
Added audio player in PDF mode and audio player app for iOS features
1.6.14
Added Yandex.Translate
1.6.12 New way to use ReaderTranslator with https://developer.apple.com/videos/**
1.6.11
1.6.10 Apple videos features
developer.apple.com/videos/play/
resources.1.6.9
1.6.8
1.6.7 Volume control
1.6.6 Features for https://developer.apple.com/videos/**
Safari extension only
1.6.5 Features for https://developer.apple.com/videos/**
Safari extension only
1.6.4 Features for https://developer.apple.com/videos/**
Safari extension only
1.6
1.5.4
1.5.3
Ctrl
1.5.2
brew install swiftlint
1.5
1.4.3
Open PDF file
in the bottom status menu`)1.4.2
1.4
You are curious about why same text are opened in both GTranslator and Safari. There are two reasons.
First you can select a particular sentence in GTranslator to translate it in Reverso.
Second you can select a particular sentence in Safari to translate it in GTranslator.
1.3.7
ReaderTranslatorMac.dmg
. You can find them here1.3.6
1.3.5
1.3.4
1.3.2
1.3.0
Support *Reverso Context* [features](https://github.com/filimo/ReaderTranslator/issues/19)
You can use it with Safari
You can use it with the build-in web browser
You can use it with with the bild-in PDF viewer
Ctrl
Alt
New WebKit architecture issue
┌────────────────┐ ┌────────────────┐
│ │ │ │
│ View │────────openSafari───────────────▶│ Safari │
│ │ │ │
└────────────────┘ └────────────────┘
│ │
│ │
makeView updateView ┌──────────────────────┐
│ │ │ │
▼ ▼ ┌───────────────────▶│ WKPage │
┌────────────────┐ │ │ │
│ │ makeView └──────────────────────┘
│ WKPepresenter │───────────────────┘ │ │ ▲
│ │ ┌──────────────────┐ │ │ │
└────────────────┘──makeView │ WKScriptsSetup │ │ │ │
└───────▶│ │ create ┌┘ goBack handler
┌───────────────────────┐ └──────────────────┘ │ load │
│ WKCoordinator │ │ │ │ │
│ │ │ ▼ │ │
└───────────────────────┘ │ ┌──────────▼───────────┐
▲ ▲ │ │ WKWebView │
│ │ └──setup─────▶│ │
│ │ └──────────────────────┘
│ │ ┌────────────────────────┐ │ │
│ │ │ WKScriptMessageHandler │ │ │
│ └──────────────│ │◀───┘ │
┌──────────────────────┐ └────────────────────────┘ │
│ WKNavigationDelegate │ │
│ │◀──────────────────────────navigation events─┘
└──────────────────────┘
enum TranslateAction: Equatable {
case none(text: String = "")
case reverso(text: String)
case translator(text: String, noReverso: Bool = false)
func getText() -> String {
switch self {
case .none(let text): return text
case .reverso(let text): return text
case .translator(let text, _): return text
}
}
mutating func setNone() {
self = .none(text: getText())
}
}
1.2 Implemented Safari extension. You can read about coming features here and review here. It’s very intresting case when we need to make commnication between the app and extentions.
You can help me if you look at the list of open bugs.