FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Stubbing out JavaScript Extension · kenwilcox/Greaseken@5aceeed · GitHub

Commit 5aceeed

Browse files
committed
Stubbing out JavaScript Extension
1 parent f39b34a commit 5aceeed

5 files changed

Lines changed: 288 additions & 0 deletions

File tree

‎Extension/Action.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var Action = function() {};
2+
3+
Action.prototype = {
4+
run: function(parameters) {
5+
//
6+
},
7+
finalize: function(parameters) {
8+
//
9+
}
10+
};
11+
12+
var ExtensionPreprocessingJS = new Action
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// ActionViewController.swift
3+
// Extension
4+
//
5+
// Created by Kenneth Wilcox on 4/2/16.
6+
// Copyright © 2016 Kenneth Wilcox. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import MobileCoreServices
11+
12+
class ActionViewController: UIViewController {
13+
14+
@IBOutlet weak var imageView: UIImageView!
15+
16+
override func viewDidLoad() {
17+
super.viewDidLoad()
18+
19+
if let inputItem = extensionContext!.inputItems.first as? NSExtensionItem {
20+
if let itemProvider = inputItem.attachments?.first as? NSItemProvider {
21+
itemProvider.loadItemForTypeIdentifier(kUTTypePropertyList as String, options: nil) { [unowned self] (dict, error) in
22+
// do stuff!
23+
}
24+
}
25+
}
26+
}
27+
28+
override func didReceiveMemoryWarning() {
29+
super.didReceiveMemoryWarning()
30+
// Dispose of any resources that can be recreated.
31+
}
32+
33+
@IBAction func done() {
34+
// Return any edited content to the host app.
35+
// This template doesn't do anything, so we just echo the passed in items.
36+
self.extensionContext!.completeRequestReturningItems(self.extensionContext!.inputItems, completionHandler: nil)
37+
}
38+
39+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="ObA-dk-sSI">
3+
<dependencies>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
6+
</dependencies>
7+
<scenes>
8+
<!--Image-->
9+
<scene sceneID="7MM-of-jgj">
10+
<objects>
11+
<viewController title="Image" id="ObA-dk-sSI" customClass="ActionViewController" customModule="Extension" customModuleProvider="target" sceneMemberID="viewController">
12+
<layoutGuides>
13+
<viewControllerLayoutGuide type="top" id="qkL-Od-lgU"/>
14+
<viewControllerLayoutGuide type="bottom" id="n38-gi-rB5"/>
15+
</layoutGuides>
16+
<view key="view" contentMode="scaleToFill" id="zMn-AG-sqS">
17+
<rect key="frame" x="0.0" y="0.0" width="320" height="528"/>
18+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19+
<subviews>
20+
<navigationBar contentMode="scaleToFill" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="NOA-Dm-cuz">
21+
<rect key="frame" x="0.0" y="20" width="320" height="44"/>
22+
<items>
23+
<navigationItem id="3HJ-uW-3hn">
24+
<barButtonItem key="leftBarButtonItem" title="Done" style="done" id="WYi-yp-eM6">
25+
<connections>
26+
<action selector="done" destination="ObA-dk-sSI" id="Qdu-qn-U6V"/>
27+
</connections>
28+
</barButtonItem>
29+
</navigationItem>
30+
</items>
31+
</navigationBar>
32+
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9ga-4F-77Z">
33+
<rect key="frame" x="0.0" y="64" width="320" height="464"/>
34+
</imageView>
35+
</subviews>
36+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
37+
<constraints>
38+
<constraint firstAttribute="trailing" secondItem="NOA-Dm-cuz" secondAttribute="trailing" id="A05-Pj-hrr"/>
39+
<constraint firstItem="9ga-4F-77Z" firstAttribute="top" secondItem="NOA-Dm-cuz" secondAttribute="bottom" id="Fps-3D-QQW"/>
40+
<constraint firstItem="NOA-Dm-cuz" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leading" id="HxO-8t-aoh"/>
41+
<constraint firstAttribute="trailing" secondItem="9ga-4F-77Z" secondAttribute="trailing" id="Ozw-Hg-0yh"/>
42+
<constraint firstItem="9ga-4F-77Z" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leading" id="XH5-ld-ONA"/>
43+
<constraint firstItem="n38-gi-rB5" firstAttribute="top" secondItem="9ga-4F-77Z" secondAttribute="bottom" id="eQg-nn-Zy4"/>
44+
<constraint firstItem="NOA-Dm-cuz" firstAttribute="top" secondItem="qkL-Od-lgU" secondAttribute="bottom" id="we0-1t-bgp"/>
45+
</constraints>
46+
</view>
47+
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
48+
<size key="freeformSize" width="320" height="528"/>
49+
<connections>
50+
<outlet property="imageView" destination="9ga-4F-77Z" id="5y6-5w-9QO"/>
51+
<outlet property="view" destination="zMn-AG-sqS" id="Qma-de-2ek"/>
52+
</connections>
53+
</viewController>
54+
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
55+
</objects>
56+
<point key="canvasLocation" x="252" y="-124"/>
57+
</scene>
58+
</scenes>
59+
</document>

‎Extension/Info.plist‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>Extension</string>
9+
<key>CFBundleExecutable</key>
10+
<string>$(EXECUTABLE_NAME)</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>$(PRODUCT_NAME)</string>
17+
<key>CFBundlePackageType</key>
18+
<string>XPC!</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>1</string>
25+
<key>NSExtension</key>
26+
<dict>
27+
<key>NSExtensionAttributes</key>
28+
<dict>
29+
<key>NSExtensionJavaScriptPreprocessingFile</key>
30+
<string>Action</string>
31+
<key>NSExtensionActivationRule</key>
32+
<dict/>
33+
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
34+
<string>1</string>
35+
</dict>
36+
<key>NSExtensionMainStoryboard</key>
37+
<string>MainInterface</string>
38+
<key>NSExtensionPointIdentifier</key>
39+
<string>com.apple.ui-services</string>
40+
</dict>
41+
</dict>
42+
</plist>

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL