Swiftpack.co - Package - ArtSabintsev/Freedom

Freedom 🦅

The Freedom to Open URLs in Third-Party Browsers on iOS with Custom UIActivity Subclasses.

Swift Support

CocoaPods Carthage Compatible SwiftPM Compatible CocoaPods CocoaPods

About

Freedom enables your app to open URLs in third-party browsers that your users have installed on their device.

Currently Supported

Screenshot

Installation Instructions

| Swift Version | Branch Name | Will Continue to Receive Updates? | ------------- | ------------- | ------------- | 4.1 | master | Yes | 3.2 | swift3.2 | No | 3.1 | swift3.1 | No

CocoaPods

For Swift 4 support:

pod 'Freedom'

For Swift 3.2 support:

pod 'Freedom', :git => 'https://github.com/ArtSabintsev/Freedom.git', :branch => 'swift3.2'

For Swift 3.1 support:

pod 'Freedom', :git => 'https://github.com/ArtSabintsev/Freedom.git', :branch => 'swift3.1'

Carthage

For Swift 4 support:

github "ArtSabintsev/Freedom"

For Swift 3.2 support:

github "ArtSabintsev/Freedom", "swift3.2"

For Swift 3.1 support:

github "ArtSabintsev/Freedom", "swift3.1"

Swift Package Manager

.Package(url: "https://github.com/ArtSabintsev/Freedom.git", majorVersion: 1)

Usage

Open your Info.plist file, and add the following URL schemes to the LSApplicationQueriesSchemes key:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>brave</string>
  <string>dolphin</string>
  <string>firefox</string>
  <string>firefox-focus</string>
  <string>googlechrome</string>
</array>

Add the following code to some actionable/tappable element in your project. In this example, I am using an IBAction from a UIButton.

@IBAction func openURL(_ sender: UIButton) {

       // A Sample URL that just happens to be my personal website.
       let url = URL(string: "http://www.sabintsev.com")!

       // Enable Debug Logs (disabled by default)
       Freedom.debugEnabled = true

       // Fetch activities for Safari and all third-party browsers supported by Freedom (see screenshot).
       let activities = Freedom.browsers()

       // Alternatively, one could select a specific browser (or browsers).
       // let activities = Freedom.browsers([.chrome])
       let vc = UIActivityViewController(activityItems: [url], applicationActivities: activities)

       present(vc, animated: true, completion: nil)
   }

Notes

Even if you enable Freedom to support all browsers via Freedom.browsers(), only the browsers installed on your users device will be visible to the them in the share sheet (i.e., UIActivityViewController). Therefore, it is beneficial to all of your users to initialize Freedom with all supported browsers.

Created and maintained by

Arthur Ariel Sabintsev

Github

link
Stars: 67
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

2.1.3 - Apr 5, 2018

  • Updates sample project
  • Updated podspec file
  • Now compatible with Swift 4.1

2.1.2 - Sep 29, 2017

Fixed an issue where Safari was not being launched on iOS 10/iOS 11.

2.1.1 - Sep 23, 2017

Fixed extremely rare crash when user tapped on a browser activity to open a URL.

2.1.0 - Sep 14, 2017

Added Support for Firefox Focus now that Firefox Focus #32 has been resolved.

Note: This feature is only available on the master branch (e.g., the Swift 4 branch).

2.0.0 - Sep 14, 2017

Freedom v2.0.0 adds support for Swift 4 / iOS 11 / Xcode 9. Only minor changes were made under-the-hood.

Moving forward, only support for the Swift 4 codebase (on master) will be maintained.

| Swift Version | Branch Name | Will Continue to Receive Updates? | ------------- | ------------- | ------------- | 4.0 | master | Yes | 3.2 | swift3.2 | No | 3.1 | swift3.1 | No