Post

Replies

Boosts

Views

Activity

Comment on How to implement Content Filter in macOS
Thanks for your feedback I really appreciate it. Yeah sorry, it is NEFilterControlProvider. If filterBrowsers is not supported on macOS, How do I implement a working demo? I'm building a mac application that blocks URLs based on categories. For eg. If a user tries to open vimeo.com, It must be blocked. Is there any alternative to achieve that?
Apr ’22
Comment on How to implement Content Filter in macOS
I tried your code this way, doesn't work, Is there anything wrong here? `class FilterDataProvider: NEFilterDataProvider {   override func startFilter(completionHandler: @escaping (Error?) -> Void) {     let exampleRule = NENetworkRule(       remoteNetwork: NWHostEndpoint(hostname: "https://www.vimeo.com/", port: "0"),       remotePrefix: 0,       localNetwork: nil,       localPrefix: 0,       protocol: .TCP,       direction: .any     )     let filterRule = NEFilterRule(networkRule: exampleRule, action: .drop)     let filterSettings = NEFilterSettings(rules: [filterRule], defaultAction: .drop)     apply(filterSettings) { error in       if let applyError = error {         os_log("Failed to apply filter settings: %@", applyError.localizedDescription)       }       completionHandler(error)     }   }   override func stopFilter(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {     completionHandler()   }   override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict {     return .drop()   } }`
Apr ’22