Skip to content

miquellaboria/TUSafariActivity

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TUSafariActivity

Version License Platform

TUSafariActivity is a UIActivity subclass that provides an "Open In Safari" action to a UIActivityViewController.

TUSafariActivity screenshot

Installation

CocoaPods

TUSafariActivity is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TUSafariActivity', '~> 1.0'

Usage

(See example Xcode project)

Simply alloc/init an instance of TUSafariActivity and pass that object into the applicationActivities array when creating a UIActivityViewController.

Objective-C

NSURL *URL = [NSURL URLWithString:@"http://google.com"];
TUSafariActivity *activity = [[TUSafariActivity alloc] init];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[URL] applicationActivities:@[activity]];

Swift

let URL = NSURL(string: "http://google.com")!
let activity = TUSafariActivity()
let activityViewController = UIActivityViewController(activityItems: [URL], applicationActivities: [activity])

Note that you can include the activity in any UIActivityViewController and it will only be shown to the user if there is a URL in the activity items.

About

A UIActivity subclass that opens URLs in Safari

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 47.7%
  • Shell 42.4%
  • Ruby 5.3%
  • C 4.6%