Latest 1.0.2
Homepage https://github.com/alexruperez/ARWebServerActivity
License MIT
Platforms ios 6.0, requires ARC
Dependencies GCDWebServer/WebUploader
Frameworks UIKit, CoreGraphics
Authors

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 [email protected]: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.

Latest podspec

{
    "name": "ARWebServerActivity",
    "version": "1.0.2",
    "license": "MIT",
    "summary": "A UIActivity subclass that share files via GCDWebServer with Twitter Bootstrap UI.",
    "homepage": "https://github.com/alexruperez/ARWebServerActivity",
    "screenshots": "https://raw.githubusercontent.com/alexruperez/ARWebServerActivity/master/screenshot.png",
    "authors": {
        "Alex Rupu00e9rez": "[email protected]"
    },
    "social_media_url": "http://twitter.com/alexruperez",
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/alexruperez/ARWebServerActivity.git",
        "tag": "1.0.2"
    },
    "source_files": "ARWebServerActivity/*.{h,m,swift}",
    "resources": "ARWebServerActivity/ARWebServerActivity.bundle",
    "requires_arc": true,
    "frameworks": [
        "UIKit",
        "CoreGraphics"
    ],
    "dependencies": {
        "GCDWebServer/WebUploader": [
            "~> 3.3"
        ]
    }
}

Pin It on Pinterest

Share This