Git Product home page Git Product logo

filimo / readertranslator Goto Github PK

View Code? Open in Web Editor NEW
115.0 4.0 13.0 185.1 MB

PDF/WebPages Reader with embedded Google Translate and voice engine on SwiftUI, Combine, Catalyst, AppKit

Swift 83.12% JavaScript 11.39% HTML 0.19% Objective-C 5.30%
swiftui combine-framework catalyst safari-extension google-translator macos voice-engines javascript ipados apple-videos-features nwlistener peer-to-peer english-learning language-learning education english-dictionary dictionaries english-translation swift chatgpt

readertranslator's Introduction

ReaderTranslator

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.

Here are video gifs of using on macOS. Wait for when they will downloaded.

Другие каналы на русском о SwiftUI, Combine и Swift

Swift, Xcode разработка под iOS, macOS
CocoaHeads Chat
The Swift Developers|Сообщество разработчиков
Server Side Swift Developer (SSSD) - russian/ukraine/etc. (сообщество Vapor, Kitura, Perfect, Smoke, Tris)

Help

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.

Support

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.

Goals

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.

Base idea

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

Projects

  • macOS
  • macOS Catalyst
  • iPadOS
  • iOS
  • Safari extension

Requirements

  • macOS 10.15 Catalina
  • iOS 13
  • iPadOS

How to install on macOS

  • Download ReaderTranslatorMac.dmg from https://github.com/filimo/ReaderTranslator/releases
  • Open downloaded ReaderTranslatorMac.dmg
  • Copy ReaderTranslatorMac to Applications folder
  • Open ReaderTranslatorMac by the right click and click Open button (might require two attempts)
  • Enable ReaderTranslatorSafari extension in Safari->Preferences->Extensions

Important

If you want to translate selected text from Safari you should enable ReaderTranslatorSafari extension in Safari preferences

Catalyst project for macOS has some problems:

  • Select a text in WKWebView
  • Handle key events
  • Support Safari extension
  • Smart zoom doesn't work

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.

Features

  • Support MacOS, ipadOS, iOS
  • Read PDF books or Web pages
  • Translate selected words or sentences through Google Translate and Reverso
  • Voice words or sentences though voice engines with rate speech, Google Translate and Reverso
  • Adjust speech rate

Goals

Explore features, limitations and bugs SwiftUI, Combine and Catalyst.

Coming features

Commits:

291a055

Releases

I stop to make .dmg for now.

Download .dmg from here

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

  • Play next audio automatically
  • Sleep timer

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/**

  • Navigate backward or forward through phrases and send them to ReaderTranslator by pressing LeftArrow or RightArrows key
  • Go to the previous phrase, highlight it and add it to ReaderTranslator before the current text by Shift + the left arrow key
  • Go to the next phrase, highlight it and add it to ReaderTranslator after the current text by Shift + the right arrow key
  • Send the current phrase to ReaderTranslator / Start playing the video pressing "/" key
  • Prevent to start playing video after you stop it and start to navigate through phrases
  • Speed up or down speech rate by pressing "-" or "+" keys

1.6.11

  • Apple videos features: Add the previous phrase to ReaderTranslator by pressing Shift + LeftArrow buttons.

1.6.10 Apple videos features

  • Improved shortcuts functionality to convenience navigation, voicing and translations of phrases in developer.apple.com/videos/play/ resources.

1.6.9

  • Apple videos features: Send the current and previous phrase by "<" key to ReaderTranslator

1.6.8

  • Apple videos features: Send the entire sentence by "f" key to ReaderTranslator

1.6.7 Volume control

1.6.6 Features for https://developer.apple.com/videos/** Safari extension only

  • Press the down arrow button to decrease the speech rate
  • Press the up arrow button to increase the speech rate

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

  • Highlight the speaking text in Apple videos transcripts
  • Go to a previous sentence by left arrow button
  • Send selected text in transcripts to ReaderTranslator by pressing "t"
  • Play/pause apple videos by pressing "p"

1.6

  • Implement San Francisco font to display icons on macOS corretly #49

1.5.4

  • Fixed getting action event in GTranslator
  • Limit the amount of translated words for different views

1.5.3

  • New way to send multiple action events to views. TranslateAction.swift
  • Send selected text in any view to all enabled views.
  • Send selected text in Reverso to all enabled views without pressing Ctrl

1.5.2

  • Implemented SwiftLint
  • Installation: brew install swiftlint

1.5

  • Speak a word or sentences by Macmillan, Collins, Longman, Reverso speakers.
  • See explanations words in Macmillan, Collins, Longman, Reverso dictionaries.
  • Look at the information on Wikipedia

  • Any view can be shown or hidden by clicking on a name view.
  • Paste selected text to any view by clicking a button next to a name view

1.4.3

  • Open any PDF file (MacOS has restrictions on opening files hence you should select a PDF file after starting the app by clicking on Open PDF file in the bottom status menu`)

1.4.2

  • Fixed an issue with translating text with invalid characters in Reverso.

1.4

  • Open selected text by service menu items in Safari and GTranslator #40

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

  • Build ReaderTranslatorMac.dmg . You can find them here

1.3.6

  • If there isn't selected text in GTranslator then text is spoken from input tag
  • If there isn't selected text in Reverso then text is spoken from textarea tag

1.3.5

1.3.4

  • Add button to Reverso to speak text by Reverso
  • Add button to GTranslator to speak text by Reverso

1.3.2

  • Fix: Crash the app when switching between view modes
  • Fix: Translate/Speak selected text in WebPage

1.3.0

Support *Reverso Context* [features](#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

  • Selected text in Safari will be sent to Reverso if it has less than 10 words
  • Selected text in the build-in Google Translator will be send to Reverso
  • Selected text in the build-in Reverso could be translated by pressing Ctrl
  • Selected text in the build-in Reverso could be speaked by pressing 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─┘
            └──────────────────────┘

TranslateAction here

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.

DEMO

readertranslator's People

Contributors

filimo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

readertranslator's Issues

Zoom recovery sometimes doesn't work after a web page is loaded.

I use this fix but sometimes it doesn't work properly.

    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        //TODO: it's the hack it need research the issue why zoom doesn't work just after a page is loaded
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
            self.scrollView.zoomScale = self.store.zoom
        }
    }

Some times TravisCI can't deploy

Fix: Travis runs two builds of pushed commit for tag and master branch simultaneously b8f9f90

/Users/travis/.rvm/gems/ruby-2.6.4/gems/octokit-4.6.2/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)
461	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/faraday-0.15.4/lib/faraday/response.rb:9:in `block in call'
462	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/faraday-0.15.4/lib/faraday/response.rb:61:in `on_complete'
463	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/faraday-0.15.4/lib/faraday/response.rb:8:in `call'
464	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/octokit-4.6.2/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
465	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/octokit-4.6.2/lib/octokit/middleware/follow_redirects.rb:61:in `call'
466	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
467	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
468	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/faraday-0.15.4/lib/faraday/connection.rb:138:in `get'
469	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/sawyer-0.8.2/lib/sawyer/agent.rb:94:in `call'
470	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/octokit-4.6.2/lib/octokit/connection.rb:154:in `request'
471	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/octokit-4.6.2/lib/octokit/connection.rb:19:in `get'
472	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/octokit-4.6.2/lib/octokit/client/users.rb:34:in `user'
473	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-releases-1.10.13/lib/dpl/provider/releases.rb:58:in `user'
474	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-releases-1.10.13/lib/dpl/provider/releases.rb:83:in `setup_auth'
475	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-releases-1.10.13/lib/dpl/provider/releases.rb:87:in `check_auth'
476	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-1.10.13/lib/dpl/provider.rb:187:in `block in deploy'
477	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-1.10.13/lib/dpl/cli.rb:41:in `fold'
478	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-1.10.13/lib/dpl/provider.rb:186:in `deploy'
479	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-1.10.13/lib/dpl/cli.rb:32:in `run'
480	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-1.10.13/lib/dpl/cli.rb:7:in `run'
481	from /Users/travis/.rvm/gems/ruby-2.6.4/gems/dpl-1.10.13/bin/dpl:5:in `<top (required)>'
482	from /Users/travis/.rvm/gems/ruby-2.6.4/bin/dpl:23:in `load'
483	from /Users/travis/.rvm/gems/ruby-2.6.4/bin/dpl:23:in `<main>'

Set up the SSH keys
travis-deploy.md
encrypt tool not finishing
REST API v3
Best Practices in Securing Your Data

Use one JavaScript file for all targets

Make general logic for Safari extension and WKScriptMessageHandler

  • If there isn't selected text in GTranslator then text is spoked from input tag
  • If there isn't selected text in Reverso then text is spoked from textarea tag

New WebKit and Safari architecture

Improve architecture to manage WebKit and Safari

draw.io

    ┌────────────────┐                                  ┌────────────────┐
    │                │                                  │                │
    │      View      │────────openSafari───────────────▶│     Safari     │
    │                │                                  │                │
    └────────────────┘                                  └────────────────┘
    │                │
    │                │
makeView        updateView                                    ┌──────────────────────┐
    │                │                                        │                      │
    ▼                ▼                   ┌───────────────────▶│      WKPageView      │
    ┌────────────────┐                   │                    │                      │
    │                │               makeView                 └──────────────────────┘
    │ WKPepresenter  │───────────────────┘                    │           │          ▲
    │                │                ┌──────────────────┐    │           │          │
    └────────────────┘──makeView      │  WKScriptsSetup  │    │           │          │
                             └───────▶│                  │ create        ┌┘   goBack handler
     ┌───────────────────────┐        └──────────────────┘    │        load          │
     │     WKCoordinator     │                  │             │          │           │
     │                       │                  │             ▼          ▼           │
     └───────────────────────┘                  │             ┌──────────────────────┐
     ▲           ▲                              │             │      WKWebView       │
     │           │                              └──setup─────▶│                      │
     │           │                                            └──────────────────────┘
     │           │              ┌────────────────────────┐    │           │
     │           │              │ WKScriptMessageHandler │    │           │
     │           └──────────────│                        │◀───┘           │
     ┌──────────────────────┐   └────────────────────────┘                │
     │ WKNavigationDelegate │                                             │
     │                      │◀──────────────────────────navigation events─┘
     └──────────────────────┘

Safari plugin: Part 2

- [ ] Send text to the app by pressed Alt while selecting text in Safari

  • Bug: Stop speak after exiting Safari mode
  • Bug: ReaderView_Safari.onAppear is called twice

Shortcuts doesn't work.

I can't use onCommand in View because it only supports macOS.
I wrote code below but performCommand is not called

    override public var keyCommands: [UIKeyCommand]? {
        //Voice selected text with any key since performCommand isn't fired because PageWebView isn't the first responder.
        SpeechSynthesizer.speech()
        return [.init(input: "1", modifierFlags: .command, action: #selector(performCommand))]
    }

    @objc func performCommand(sender: UIKeyCommand) {
        print(sender)
    }

Share action sheet in Safari

Description:

Add app button to share actions sheet in Safari

Articles

How to use NSSharingService in Catalyst? my post in stackoverflow.com
Creating a Custom macOS Sharing Service in Swift
How to show the share button in Mountain Lion?

Все, что нужно знать об iOS App Extensions
Library? Static? Dynamic? Or Framework? Project inside another project
Bundles and Packages

Beyond the Checkbox with Catalyst and AppKit
IOS CBL and Catalyst
Ultimate Catalyst Guide
Taking iPad Apps for Mac to the Next Level

Binary Frameworks in Swift
XCFrameworks Internals

Build iOS&osX XCFramework

xcodebuild archive -scheme "CBL Swift" -destination "generic/platform=OS X" -destination "generic/platform=ios" -destination "generic/platform=iOS Simulator" SKIP_INSTALL=NO

iOS->framework

public protocol ReaderTranslatorCommonInterfaces {
    func test() -> String
}

macOS->bundle

Info.plist -> Principal class = ReaderTranslatorAppKit.ReaderTranslatorAppKit
open class ReaderTranslatorAppKit: ReaderTranslatorCommonInterfaces {
    public func test() -> String {
        "test 1"
    }
}

import AppKit

extension NSSharingService {
    class func shareContent ( content: [AnyObject], button: NSButton ) {
        let sharingServicePicker = NSSharingServicePicker (items: content )

        sharingServicePicker.showRelativeToRect(button.bounds, ofView: button, preferredEdge: NSRectEdge.MaxY)
}

}

ReaderTranslator

ReaderTranslator -> Build Phases -> Copy Bundle Resources -> ReaderTranslatorAppKit.bundle
ReaderTranslator -> Signing -> Team -> Viktor Kushnerov
if let bundlePath = Bundle.main.path(forResource: "ReaderTranslatorAppKit", ofType: "bundle"),
    let bundle = Bundle(path: bundlePath) {
    
    bundle.load()

    if let cls = bundle.principalClass as? NSObject.Type,
        let plugin = cls.init() as? ReaderTranslatorCommonInterfaces {
        print(plugin.test())
    }
    print(bundle)
}

Implement Reverso Context: part 2

Part 1

  • Add button to GTranslator to speak text by Reverso cc4a2c7
  • Add button to Reverso to speak text 4deffef
  • Save login in ReversoContext
  • Add back and forward ReversoContext buttons
  • Add button to open ReversoContext page in Safari
  • Change build version

Google Translate: URL interface

currentTab: Store current tab in UserDefault
savedLastWebPage: Store all the last pages in UserDefault
lastWebPage: The last webpage in current tab
newUrl: current url of WebView

Chain of changes

lastWebPage -> newUrl

newUrl -> debounce -> webView.url?.absoluteString != newUrl -> encode -> webView.url?.absoluteString

didFinish -> self.url?.absoluteString -> decode -> lastWebPage

Safari plugin: Part 1

  • Enable/disable plugin
    • #20 Implement macOS project target
    • show/hide viewer
    • send selected text from Safari to the app cba6550
    • Show Safari plugin status and click on status to switch on/off bc40db1 e281898
    • Support shortcuts in Safari web pages d9b6f58 f6fe4b4
      • disable/enable translating selected text in Safari by shortcut s or Ctrl/Alt+s
      • disable/enable speaking selected text in Safari by shortcut a or Ctrl/Alt+a
    • #21 .lineLimit(nil) doesn't works for TextField
    • Improve: Send shared messages every 1 second 43bc87b
    • Improve: speak method 43bc87b
    • Bug: #22 Google Translate view goes over the top border e281898

Important

  1. Info.plist
<dict>
    <key>Allowed Domains</key>
    <array>
        <string>*</string>
    </array>
    <key>Level</key>
    <string>All</string>
</dict>
  1. Info.plist
<key>NSAppleEventsUsageDescription</key>
<string>ReaderTranslator communicates with other apps on your Mac when you choose to share a news item.</string>
  1. Info.plist
<key>AppIdentifierPrefix</key>
<string>$(AppIdentifierPrefix)</string>
  1. Add App Group
  2. See Important #20

Info

My question about CFNotificationCenterGetDarwinNotifyCenter on stackoverlow
Sharing data between iOS apps and app extensions
How to Build Safari App Extensions
More articles about it in #6

If the extension runs as a separate process then this is impossible: Memory allocated in one process is not available in a different process. – Martin R 9 hours ago
Sound strange I see CFNotificationCenterGetDarwinNotifyCenter manage it. – Victor Kushnerov 9 hours ago

Compare developer.apple.com/documentation/corefoundation/…: if center is a Darwin notification center then object and userInfo are ignored. – Martin R 9 hours ago
How max length a message name? – Victor Kushnerov 9 hours ago

I have no idea ... – Martin R 9 hours ago
I guess I have to use combine UserDefaults and CFNotificationCenterGetDarwinNotifyCenter to send some long text? – Victor Kushnerov 9 hours ago

Compare stackoverflow.com/a/35206961/1187415. – Martin R 9 hours ago
Thanks for point out that object and userInfo are ignored. I missed it. Why use UnsafeRawPointer in same process? – Victor Kushnerov 8 hours ago

Here is an example where the raw pointer is used to pass a pointer to a class instance to the callback function. – Martin R 8 hours ago
I see but I can't imagine a situation why it is necessary since class it is reference type? – Victor Kushnerov 8 hours ago
When I call some method with class type parameter I send a pointer. – Victor Kushnerov 8 hours ago

CFNotificationCenterPostNotification is actually a C function, and the callback is also a pure C function. C knows nothing about Swift types or instance pointers. That's why the object parameter is a UnsafeRawPointer (the Swift equivalent of void *). – Martin R 8 hours ago
Awesome, I got it now, thanks. – Victor Kushnerov 8 hours ago
I add stackoverflow.com/a/58188965/4067700 to help guys to get the goal quickly. The question is closed by me thanks @MartinR. – Victor Kushnerov 7 hours ago

Favorite sentences in Reverso

  • If selected text in empty then bookmark button is hidden
  • Add/remove selected text in Bookmarks
  • Show/hide Bookmarks
  • Write lists to Pasteboard

Favorite voices

  • Add star button on the right of language selector.
  • Add/Remove current voice in favorites.
  • Show favorites in context menu of star button.

Build-times-out-because-no-output-was-received in TravisCI

139.63s$ create-dmg --volname "Application Installer" --hide-extension "Application.app" --app-drop-link 600 185 "ReaderTranslatorMac.dmg" "ReaderTranslatorMac.app/"
383Creating disk image...
384created: /Users/travis/build/filimo/ReaderTranslator/rw.ReaderTranslatorMac.dmg
385Mounting disk image...
386Unmounting disk image...
387Mount directory: /Volumes/Application Installer
388Device name:     /dev/disk2
389making link to Applications dir
390/Volumes/Application Installer
391Running Applescript: /usr/bin/osascript "/var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/createdmg.tmp.XXXXXXXXXX.ABbku2zT" "Application Installer"
392/var/folders/17/5mc7816d3mndxjqgplq6057w0000gn/T/createdmg.tmp.XXXXXXXXXX.ABbku2zT:394:406: execution error: Finder got an error: AppleEvent timed out. (-1712)
393Done running the applescript...
394Fixing permissions...
395Done fixing permissions.
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
490Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

Finder got an error: AppleEvent timed out. (-1712)

Improve UserDefaults

UserDefaults+Key

To avoid issue while saving nil properties

let myData = NSKeyedArchiver.archivedData(withRootObject: myJson)
UserDefaults.standard.set(myData, forKey: "userJson")

let recovedUserJsonData = UserDefaults.standard.object(forKey: "userJson")
let recovedUserJson = NSKeyedUnarchiver.unarchiveObject(with: recovedUserJsonData)

Webpage task manager

Fields

  • Status (checkbox)
  • Link
  • Description

Description
Add tasks manager for web pages that you want to read.

Script
Clicking on a list item to open the link into current web tab.

Goals
Use Core Data to store the Wish List

Icons

  • Safari extension
  • The app

Implement Reverso Context: part 1

  • Translate selected text in ReversoContext by GTranslator 7c89a1f
  • Translate selected text in GTranslator by ReversoContext 7c89a1f
  • New WebKit and Safari architecture #27 9c2db25
  • ~~Repeat selected text by Cmd key in `GTranslator``` 48208f7 c055e48
  • Repeat selected text by [none, Ctrl, Alt]-r key in ReversoContext 7531254
  • Speak selected text by Alt+Cmd in Safari baf30b0 9369957
  • WKNavigationDelegate aren't invoked 038a0a1
  • Implement TranslateAction 7a72315
  • Prevent to speak selected text by holding Alt or Cmd while selecting text with in Safari 5f1f8fb 1ae75e0
  • Speak ReversoContext by press special button or Cmd or Alt 0751c26
  • Send javascript events to Safari extension through debounce 6508fdd
  • Send selected text in ReversoContext to Translator by Ctrl cb4e010
  • Speak selected text in ReversoContext by Alt cb4e010
  • Speak selected text in GTranslator by Alt key 6a7251d
  • Support languages in GTranslator 6bd9db8
  • Support languages in ReversoContext dd1346f
  • Send selected text < 10 words from PDF, WebPage, Safari to ReversoContext dd1346f
  • Add back and forward GTranslator buttons 7a72315

Implement macOS project target

Add macOS project target which is necessary for support Safari plugin #15

  • Add support macOS project target aba57ae
  • Implement unsupported features in AppKit
    • UIViewRepresentable aba57ae
    • Image(systemName: String) aba57ae
    • scrollView of WKWebView f993203
    • Speak selected text by MetaLeft key c055e48
    • Implement NSTextView #21

Important

  1. Enable Outgoing Connections (Client)
  2. Info.plist
<key>AppIdentifierPrefix</key>
<string>$(AppIdentifierPrefix)</string>
  1. Add Safari extension to Embedded Content

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.