Skip to content

Commit

Permalink
iOS Quick Actions with Today's Extension Widget added.
Browse files Browse the repository at this point in the history
  • Loading branch information
anupamchugh committed Nov 30, 2019
1 parent 2d826b8 commit b6371e1
Show file tree
Hide file tree
Showing 19 changed files with 1,064 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Today View Controller-->
<scene sceneID="cwh-vc-ff4">
<objects>
<viewController id="M4Y-Lb-cyx" customClass="TodayViewController" customModule="QuickActionWidget" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
<rect key="frame" x="0.0" y="0.0" width="320" height="37"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BDG-Iv-vn3">
<rect key="frame" x="137" y="47" width="46" height="23"/>
<color key="backgroundColor" systemColor="systemYellowColor" red="1" green="0.80000000000000004" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<state key="normal" title="Button">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
</state>
<connections>
<action selector="onButtonTap:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="ITv-6G-cZt"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="ssy-KU-ocm" firstAttribute="trailing" secondItem="BDG-Iv-vn3" secondAttribute="trailing" constant="137" id="U4c-I5-894" userLabel="Safe Area.trailing = Button.trailing"/>
<constraint firstItem="BDG-Iv-vn3" firstAttribute="top" secondItem="ssy-KU-ocm" secondAttribute="top" constant="3" id="aW5-jJ-lA1" userLabel="Button.top = Safe Area.top"/>
<constraint firstItem="BDG-Iv-vn3" firstAttribute="bottom" secondItem="ssy-KU-ocm" secondAttribute="bottom" constant="33" id="o0u-Xr-P3W" userLabel="Button.bottom = Safe Area.bottom"/>
<constraint firstItem="BDG-Iv-vn3" firstAttribute="leading" secondItem="ssy-KU-ocm" secondAttribute="leading" constant="137" id="rPR-0c-0OW" userLabel="Button.leading = Safe Area.leading"/>
</constraints>
<viewLayoutGuide key="safeArea" id="ssy-KU-ocm"/>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="37"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="139" y="80"/>
</scene>
</scenes>
</document>
31 changes: 31 additions & 0 deletions iOS13QuickActions/QuickActionWidget/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>QuickActionWidget</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widget-extension</string>
</dict>
</dict>
</plist>
10 changes: 10 additions & 0 deletions iOS13QuickActions/QuickActionWidget/QuickActionWidget.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.iowncode.quickaction</string>
</array>
</dict>
</plist>
27 changes: 27 additions & 0 deletions iOS13QuickActions/QuickActionWidget/TodayViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// TodayViewController.swift
// QuickActionWidget
//
// Created by Anupam Chugh on 30/11/19.
// Copyright © 2019 iowncode. All rights reserved.
//

import UIKit
import NotificationCenter

class TodayViewController: UIViewController, NCWidgetProviding {

override func viewDidLoad() {
super.viewDidLoad()
}

@IBAction func onButtonTap(_ sender: Any) {
self.extensionContext?.open(URL(string: "iOS13QuickActions:https://")!)
}


func widgetPerformUpdate(completionHandler: (@escaping (NCUpdateResult) -> Void)) {
completionHandler(NCUpdateResult.newData)
}

}
Loading

0 comments on commit b6371e1

Please sign in to comment.