Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for macOS 10.14 and 10.15 #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karstenBriksoft
Copy link

The main code of this project is a safari extension. It needs a host application but only very basic.

I've added a target for macOS 10.14 and 10.15 (didn't wanted to change the existing target).
This target uses a xib for its UI and an application delegate that's written in Objective-C. There's really not much to it, but it is compatible with older OSs (it'll also be compatible with future OSs).

… and a xib to describe the UI. That should be a lot more compatible than SwiftUI
@oblador
Copy link
Owner

oblador commented Jan 26, 2021

Thanks! I know that it's possible to write it in a backwards compatible way, but a big reason for me writing this project was to explore the new capabilities of Swift UI in Big Sur. If I understand your PR correctly you basically add a new target written in ObjC that replaces the Swift UI parts? Can these somehow co-exist?

@karstenBriksoft
Copy link
Author

Yes, this PR adds another target „hush Mac“ that has target releases set to 10.14. it keeps the old „hush macOS“.

SwiftUI may be all nice and shiny but hush itself is super useful and there’s no real need for it to require Big Sur just because of the way it’s UI is created. Especially as the UI is almost never opened.

@oblador
Copy link
Owner

oblador commented Jan 27, 2021

Right, but then that would be two separate apps?

@karstenBriksoft
Copy link
Author

in the current implementation yes. As the "hush mac" target works on Big Sur, too, the "hush macOS" target could also be removed.

@DenTelezhkin
Copy link

DenTelezhkin commented Jan 27, 2021

Alternatively, it's also possible to lower deployment target to mac OS 10.15, it seems that macOS 11 is required for following components of the code:

  • NSApplicationDelegateAdaptor, @main - can be replaced with Swift AppDelegate
  • WindowGroup, Scene - can be replaced with Swift SceneDelegate
  • HiddenTitleBarWindowStyle - not sure about replacement
  • acccessibilityIdentifier - can be replaced with .accessibility(identifier: ) - same API, but does not require macOS 11
  • Link - can be replaced with Button, that calls NSWorkspace.shared.open(url) or UIApplication.shared.openURL

This way current SwiftUI code would mostly be preserved, and app would run on mac OS Catalina as well as iOS 13.

@karstenBriksoft
Copy link
Author

But then it only runs on Catalina and not in Mojave.

@DenTelezhkin
Copy link

@karstenBriksoft Yep, no way around that with SwiftUI. But two latest releases of iOS and macOS might be enough for most people, especially since in six months there will be another iOS / macOS round of releases.

@karstenBriksoft
Copy link
Author

that's exactly why i provide this PR with a target that doesn't use Swift UI (I'm using a Mac with Catalina and another Mac with Mojave, so this is a totally selfish requirement). The core functionality of this app is not something where SwiftUI is really needed. The app is only a medium to provide these content blocking features and these work in 10.14, too.

@DenTelezhkin
Copy link

I understand you, believe me) I have a Mac that cannot even be updated to Big Sur. But I also have pet projects written in SwiftUI and understand that sometimes supporting newer technologies might be more attractive and easier than supporting old ones even if some devices might be cut off. Ultimately, it's up to maintainer to decide what to do.

@gingerbeardman
Copy link

Thanks for this, I'm now using the Mojave fork.

@alessandro-calo
Copy link

Hi everyone,
I have a macOS 10.13 mac in which I'd like to install Hush. @karstenBriksoft is it possible/easy for your hush Mac target to support 10.13 as well? Would be much appreciated :)

@Gems
Copy link

Gems commented Apr 12, 2021

Was trying to figure out to build it and make it up and running on my Catalina mac. Besides the Code SIgning issues I had, the last bit was to enable Unsigned Extensions in Safari via Develop menu.

Now it seems to be up and running, will see how is it in action ☺️

Big thanks to @oblador, @karstenBriksoft, and all the other contributors 🤗

Comment on lines +40 to +42
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {}

Copy link

@04131988 04131988 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants