{"id":20819975,"url":"https://github.com/elo7/oahu","last_synced_at":"2025-08-09T20:07:13.255Z","repository":{"id":45026729,"uuid":"47714905","full_name":"elo7/oahu","owner":"elo7","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-01T18:27:33.000Z","size":89,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":96,"default_branch":"master","last_synced_at":"2025-07-30T04:00:34.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elo7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-09T19:47:58.000Z","updated_at":"2023-08-23T05:00:09.000Z","dependencies_parsed_at":"2025-05-07T15:44:06.737Z","dependency_job_id":"180532bc-7356-4f1e-a734-55304e9b4f5d","html_url":"https://github.com/elo7/oahu","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/elo7/oahu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Foahu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Foahu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Foahu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Foahu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elo7","download_url":"https://codeload.github.com/elo7/oahu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Foahu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269631157,"owners_count":24450144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T22:07:58.587Z","updated_at":"2025-08-09T20:07:13.206Z","avatar_url":"https://github.com/elo7.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oahu\n\n*Swift lightweight wrapper for WKWebView to maintain persisted cookies through navigation, intercept requests and handle JavaScript messages*\n\n## Requirements\n- iOS 11.0+\n- Xcode 9.0+\n\n## Instalation\nEmbedded frameworks require a minimum deployment target of iOS 8 or OS X Mavericks (10.9).\n\n\n### CocoaPods\n```ruby\nuse_frameworks!\n\npod 'Oahu', :git =\u003e 'git@github.com:elo7/oahu.git'\n```\n\n### Carthage\n```ruby\ngithub \"elo7/oahu\" \"master\"\n```\n\nAnd add the path to the framework under “Input Files”, e.g.:\n\n```\n$(SRCROOT)/Carthage/Build/iOS/oahu.framework\n```\n\n### Swift Package Manager (SPM)\n\nThe Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. To integrate using Apple's Swift package manager from xcode :\n\nFile -\u003e Add Packages... -\u003e Enter package URL : https://github.com/elo7/oahu, choose the latest release\n\n## Getting started\n#### Initialization\n```swift\nimport Oahu\nlet browser = Oahu(forView: view, allowsBackForwardNavigationGestures: true)\nbrowser.loadRequest(\"http://www.elo7.com\")\n```\n\n#### Delegate methods\nOahuDelegate responds to all WKNavigationDelegate methods\n```swift\nclass ViewController: UIViewController, OahuDelegate\n```\n\nAnd then\n\n```swift\nbrowser.oahuDelegate = self\n```\n\n#### Interceptor\nWith Oahu you can intercept requests and perform some action. It is generally used to show some native content giving a determined request.\n\nFirst you need to create a Evaluator:\n```swift\nlet evaluator = OahuEvaluator(url: \"tech\") {\n\tprint(\"Tech request blocked\")\n}\n```\n\nThe first parameter **url** is the term of the request that if appears, should stop the request.\n\nThe second parameter **closure** is the action that should be taken.\n\nYou should have an array of Evaluators and put all the Evaluators inside it.\n\n```swift\nvar evalutors = [Evaluator]()\nevalutors.append(evaluator)\n```\n\nThen you must create an Interceptor that uses all the evaluators inside the array.\n\n```swift\nlet interceptor = Interceptor(evaluators: evalutors)\n```\n\nAnd finally, instantiate Oahu with a constructor that receives another argument.\n```swift\nbrowser = Oahu(forView: view, allowsBackForwardNavigationGestures: true, interceptor: interceptor)\n```\n\n#### JavaScript handling\nSometimes you need to talk with a JavaScript posted by your website and handle in a native way. To perform that task you should do this:\n\nFirst you need to create a ScriptMessageHandler:\n```swift\nlet messageHandler = ScriptMessageHandler(forEventName: \"shippingCancel\") { param in\n\tprint(\"Perform some native task when JavaScript trigger this event\")\n}\n```\n\nThe first parameter **forEventName** is the event your JavaScript is triggering using WKWebKit convention.\n\n```swift\nwindow.webkit.messageHandlers.{NAME}.postMessage()\n```\n\nThe second parameter **handler** is the action that should be taken.\n\nYou should have an array of ScriptMessageHandlers and put yours ScriptMessageHandler inside it.\n\n```swift\nvar scriptMessages = [ScriptMessageHandlers]()\nscriptMessages.append(messageHandler)\n```\n\nThen, you just need to assign Oahu's javaScriptHandlers with your array.\n\n```swift\nbrowser?.javaScriptHandlers = scriptMessages\n```\n\n#### Load HTML String\nTo load HTML string content, you can use the same function of WKWebView\n```swift\nbrowser?.loadHTMLString(\"\u003chtml\u003e\u003cbody\u003eHi Oahu\u003c/body\u003e\u003c/html\u003e\")\n```\n\n## Contribute\n- If you **found a bug**, open an issue.\n- If you ***have a feature request***, open an issue.\n- If you ***want to contribute***, submit a pull request\n\n\n## License\nOahu is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felo7%2Foahu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felo7%2Foahu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felo7%2Foahu/lists"}