Skip to content
A UIActivity subclass that share files via GCDWebServer with Twitter Bootstrap UI.
Branch: master
Clone or download
Latest commit fde3382 Feb 2, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ARWebServerActivity Release 1.0.1 Feb 1, 2016
ARWebServerActivityExample.xcodeproj Release 1.0.1 Feb 1, 2016
ARWebServerActivityExample Release 1.0.1 Feb 1, 2016
Pods Release 1.0.1 Feb 1, 2016
.gitignore
.gitmodules First commit Apr 18, 2014
ARWebServerActivity.podspec Release 1.0.2 Feb 2, 2016
LICENSE 3... 2... 1... Launch! Apr 19, 2014
Podfile Release 1.0.1 Feb 1, 2016
Podfile.lock Release 1.0.1 Feb 1, 2016
README.md Update README.md Feb 1, 2016
screenshot.png 3... 2... 1... Launch! Apr 19, 2014

README.md

ARWebServerActivity

Twitter Version License Platform Analytics

Overview

ARWebServerActivity is a UIActivity subclass that provides an "Share via web server" action to a UIActivityViewController to share files via swisspol/GCDWebServer with Twitter Bootstrap UI.

You can share:

  • NSString as TXT File.
  • UIImage as PNG File.
  • NSURL to a local/remote file.
  • NSData as DATA File.
  • NSDictionary as JSON File.
  • NSArray as JSON File.

ARWebServerActivity screenshot

Clone the example proyect

To pull the swisspol/GCDWebServer submodule run:

git clone --recursive git@github.com:alexruperez/ARWebServerActivity.git

Requirements

  • As UIActivity is iOS >= 6 only, so is the subclass.
  • This project uses ARC. If you want to use it in a non ARC project, you must add the -fobjc-arc compiler flag to ARWebServerActivity.m and ARWebServerActivityViewController.m in Target Settings > Build Phases > Compile Sources.

Installation

Add the ARWebServerActivity subfolder to your project. There are no required libraries other than swisspol/GCDWebServer and its requirements.

Usage

(See example Xcode project)

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

ARWebServerActivity *webServerActivity = [[ARWebServerActivity alloc] init];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[@"Hello World!", [UIImage imageNamed:@"Example"], [NSURL fileURLWithPath:@"file/path"], [NSURL URLWithString:@"file/url"], [@"data" dataUsingEncoding:NSUTF8StringEncoding], @{@"key": @[@"value1", @"value2"]}, @[@"value1", @"value2"]] applicationActivities:@[webServerActivity]];
[self presentViewController:activityViewController animated:YES completion:nil];

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

Customization

To customize this control you can use:

- (instancetype)initWithPort:(NSNumber *)port bonjourName:(NSString *)bonjourName path:(NSString *)path activityViewController:(UIViewController *)activityViewController;
  • port: swisspol/GCDWebServer port.
  • bonjourName: If you want your server be visible at Bonjour.
  • path: If you want to change the local files path shared by your server. Note that will be removed after sharing.
  • activityViewController: If you want to change the default control UI, you can subclass ARWebServerActivityViewController and not call [super viewWillAppear:animated];, make your own UIViewController or improve my ARWebServerActivityViewController and make a pull request.

TO-DO (Help needed!)

  • Add (programmatically) Auto Layout constraints to ARWebServerActivityViewController and example Xcode project for screen rotation.
  • Improve ARWebServerActivityViewController UI.
You can’t perform that action at this time.