Skip to content
Snippets Groups Projects
Commit 299e4951 authored by Rodric Rabbah's avatar Rodric Rabbah Committed by Jeremias Werner
Browse files

Moved to swift client repo.

parent 79f7e3cb
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1249 deletions
OpenWhiskStarterApp.xcodeproj/xcuserdata/
OpenWhiskStarterApp.xcworkspace/
Podfile.lock
Pods/
\ No newline at end of file
github "openwhisk/openwhisk-client-swift.git" ~> 0.2.1 # Or latest version
\ No newline at end of file
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
D65844461C727BBC001581F3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65844451C727BBC001581F3 /* AppDelegate.swift */; };
D65844481C727BBC001581F3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65844471C727BBC001581F3 /* ViewController.swift */; };
D658444B1C727BBC001581F3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D65844491C727BBC001581F3 /* Main.storyboard */; };
D658444D1C727BBC001581F3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D658444C1C727BBC001581F3 /* Assets.xcassets */; };
D65844501C727BBC001581F3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D658444E1C727BBC001581F3 /* LaunchScreen.storyboard */; };
D658445D1C727C2D001581F3 /* FilterForecast.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65844571C727C2D001581F3 /* FilterForecast.swift */; };
D658445F1C727C2D001581F3 /* ResultSetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65844591C727C2D001581F3 /* ResultSetCell.swift */; };
D65844601C727C2D001581F3 /* ResultSetTableController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D658445A1C727C2D001581F3 /* ResultSetTableController.swift */; };
D65844611C727C2D001581F3 /* SelfSignedNetworkDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D658445B1C727C2D001581F3 /* SelfSignedNetworkDelegate.swift */; };
D65844621C727C2D001581F3 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D658445C1C727C2D001581F3 /* Utils.swift */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
D648FD291C72804F0088C7C1 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
D65844421C727BBC001581F3 /* OpenWhiskStarterApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenWhiskStarterApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
D65844451C727BBC001581F3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D65844471C727BBC001581F3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
D658444A1C727BBC001581F3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
D658444C1C727BBC001581F3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
D658444F1C727BBC001581F3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
D65844511C727BBC001581F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D65844571C727C2D001581F3 /* FilterForecast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FilterForecast.swift; sourceTree = "<group>"; };
D65844591C727C2D001581F3 /* ResultSetCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultSetCell.swift; sourceTree = "<group>"; };
D658445A1C727C2D001581F3 /* ResultSetTableController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultSetTableController.swift; sourceTree = "<group>"; };
D658445B1C727C2D001581F3 /* SelfSignedNetworkDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelfSignedNetworkDelegate.swift; sourceTree = "<group>"; };
D658445C1C727C2D001581F3 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
D658443F1C727BBC001581F3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
D65844391C727BBC001581F3 = {
isa = PBXGroup;
children = (
D65844441C727BBC001581F3 /* OpenWhiskStarterApp */,
D65844431C727BBC001581F3 /* Products */,
);
sourceTree = "<group>";
};
D65844431C727BBC001581F3 /* Products */ = {
isa = PBXGroup;
children = (
D65844421C727BBC001581F3 /* OpenWhiskStarterApp.app */,
);
name = Products;
sourceTree = "<group>";
};
D65844441C727BBC001581F3 /* OpenWhiskStarterApp */ = {
isa = PBXGroup;
children = (
D65844451C727BBC001581F3 /* AppDelegate.swift */,
D65844471C727BBC001581F3 /* ViewController.swift */,
D65844571C727C2D001581F3 /* FilterForecast.swift */,
D65844591C727C2D001581F3 /* ResultSetCell.swift */,
D658445A1C727C2D001581F3 /* ResultSetTableController.swift */,
D658445B1C727C2D001581F3 /* SelfSignedNetworkDelegate.swift */,
D658445C1C727C2D001581F3 /* Utils.swift */,
D65844491C727BBC001581F3 /* Main.storyboard */,
D658444C1C727BBC001581F3 /* Assets.xcassets */,
D658444E1C727BBC001581F3 /* LaunchScreen.storyboard */,
D65844511C727BBC001581F3 /* Info.plist */,
);
path = OpenWhiskStarterApp;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
D65844411C727BBC001581F3 /* OpenWhiskStarterApp */ = {
isa = PBXNativeTarget;
buildConfigurationList = D65844541C727BBC001581F3 /* Build configuration list for PBXNativeTarget "OpenWhiskStarterApp" */;
buildPhases = (
D658443E1C727BBC001581F3 /* Sources */,
D658443F1C727BBC001581F3 /* Frameworks */,
D65844401C727BBC001581F3 /* Resources */,
D648FD291C72804F0088C7C1 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = OpenWhiskStarterApp;
productName = OpenWhiskStarterApp;
productReference = D65844421C727BBC001581F3 /* OpenWhiskStarterApp.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
D658443A1C727BBC001581F3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = IBM;
TargetAttributes = {
D65844411C727BBC001581F3 = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = 76CMF53Q35;
LastSwiftMigration = 0800;
};
};
};
buildConfigurationList = D658443D1C727BBC001581F3 /* Build configuration list for PBXProject "OpenWhiskStarterApp" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D65844391C727BBC001581F3;
productRefGroup = D65844431C727BBC001581F3 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
D65844411C727BBC001581F3 /* OpenWhiskStarterApp */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
D65844401C727BBC001581F3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D65844501C727BBC001581F3 /* LaunchScreen.storyboard in Resources */,
D658444D1C727BBC001581F3 /* Assets.xcassets in Resources */,
D658444B1C727BBC001581F3 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
D658443E1C727BBC001581F3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D65844481C727BBC001581F3 /* ViewController.swift in Sources */,
D658445D1C727C2D001581F3 /* FilterForecast.swift in Sources */,
D658445F1C727C2D001581F3 /* ResultSetCell.swift in Sources */,
D65844601C727C2D001581F3 /* ResultSetTableController.swift in Sources */,
D65844611C727C2D001581F3 /* SelfSignedNetworkDelegate.swift in Sources */,
D65844461C727BBC001581F3 /* AppDelegate.swift in Sources */,
D65844621C727C2D001581F3 /* Utils.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
D65844491C727BBC001581F3 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
D658444A1C727BBC001581F3 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
D658444E1C727BBC001581F3 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
D658444F1C727BBC001581F3 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
D65844521C727BBC001581F3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
D65844531C727BBC001581F3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
D65844551C727BBC001581F3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = OpenWhiskStarterApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ibm.mobile.openwhisk.OpenWhiskStarterApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
D65844561C727BBC001581F3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = OpenWhiskStarterApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ibm.mobile.openwhisk.OpenWhiskStarterApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
D658443D1C727BBC001581F3 /* Build configuration list for PBXProject "OpenWhiskStarterApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D65844521C727BBC001581F3 /* Debug */,
D65844531C727BBC001581F3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D65844541C727BBC001581F3 /* Build configuration list for PBXNativeTarget "OpenWhiskStarterApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D65844551C727BBC001581F3 /* Debug */,
D65844561C727BBC001581F3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = D658443A1C727BBC001581F3 /* Project object */;
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:OpenWhiskStarterApp.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D65844411C727BBC001581F3"
BuildableName = "OpenWhiskStarterApp.app"
BlueprintName = "OpenWhiskStarterApp"
ReferencedContainer = "container:OpenWhiskStarterApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D65844411C727BBC001581F3"
BuildableName = "OpenWhiskStarterApp.app"
BlueprintName = "OpenWhiskStarterApp"
ReferencedContainer = "container:OpenWhiskStarterApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D65844411C727BBC001581F3"
BuildableName = "OpenWhiskStarterApp.app"
BlueprintName = "OpenWhiskStarterApp"
ReferencedContainer = "container:OpenWhiskStarterApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D65844411C727BBC001581F3"
BuildableName = "OpenWhiskStarterApp.app"
BlueprintName = "OpenWhiskStarterApp"
ReferencedContainer = "container:OpenWhiskStarterApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>OpenWhiskStarterApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>D65844411C727BBC001581F3</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="7pM-wQ-brU">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="OpenWhiskStarterApp" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M7I-TQ-eun">
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="iCm-OZ-XaR">
<constraints>
<constraint firstAttribute="height" constant="371" id="z92-Ro-Ttb"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QEd-V5-YHp" customClass="WhiskButton">
<fontDescription key="fontDescription" type="system" pointSize="36"/>
<state key="normal" title="Tap me"/>
<connections>
<action selector="whiskButtonPressedWithSender:" destination="BYZ-38-t0r" eventType="touchUpInside" id="qvA-Ie-uvP"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="M7I-TQ-eun" secondAttribute="trailing" constant="-201" id="0Cq-2Z-PG1"/>
<constraint firstItem="iCm-OZ-XaR" firstAttribute="top" secondItem="QEd-V5-YHp" secondAttribute="bottom" constant="20" id="31V-NP-8Qo"/>
<constraint firstItem="QEd-V5-YHp" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="30" id="6QQ-Gz-nfc"/>
<constraint firstItem="QEd-V5-YHp" firstAttribute="centerY" secondItem="iCm-OZ-XaR" secondAttribute="centerY" id="7QR-JG-CYl"/>
<constraint firstItem="QEd-V5-YHp" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="KtS-rV-Kmj"/>
<constraint firstItem="M7I-TQ-eun" firstAttribute="top" secondItem="iCm-OZ-XaR" secondAttribute="bottom" constant="8" symbolic="YES" id="OdF-Vl-7EV"/>
<constraint firstItem="iCm-OZ-XaR" firstAttribute="centerX" secondItem="QEd-V5-YHp" secondAttribute="centerX" id="P8K-Ph-v6a"/>
<constraint firstItem="QEd-V5-YHp" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="XL5-t1-dN2"/>
<constraint firstItem="M7I-TQ-eun" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="24" id="lc9-QT-Pah"/>
<constraint firstItem="iCm-OZ-XaR" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="pPu-2v-qpY"/>
<constraint firstItem="QEd-V5-YHp" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="zv3-B3-2tt"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="7QR-JG-CYl"/>
<exclude reference="KtS-rV-Kmj"/>
</mask>
</variation>
</view>
<navigationItem key="navigationItem" id="RoW-lt-SEL"/>
<connections>
<outlet property="outputText" destination="iCm-OZ-XaR" id="5A5-9Z-aLH"/>
<outlet property="statusLabel" destination="M7I-TQ-eun" id="xJo-lq-c6P"/>
<outlet property="whiskButton" destination="QEd-V5-YHp" id="quL-BS-Cr5"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1082" y="111"/>
</scene>
<!--Result Set Table Controller-->
<scene sceneID="Na3-rO-YLq">
<objects>
<tableViewController storyboardIdentifier="resultSetTable" id="pfI-e5-qb0" customClass="ResultSetTableController" customModule="OpenWhiskStarterApp" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="5zq-Bx-oFj">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="resultCell" selectionStyle="default" indentationWidth="10" reuseIdentifier="resultCell" id="2Qj-SE-RfV" customClass="ResultSetCell" customModule="OpenWhiskStarterApp" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2Qj-SE-RfV" id="9XQ-vB-6gL">
<frame key="frameInset" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="mu1-ck-cFH">
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qpi-tj-4sQ">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Value" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XZ7-97-d2a">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstItem="mu1-ck-cFH" firstAttribute="centerY" secondItem="9XQ-vB-6gL" secondAttribute="centerY" id="LOc-Bq-FLv"/>
<constraint firstItem="mu1-ck-cFH" firstAttribute="top" secondItem="9XQ-vB-6gL" secondAttribute="topMargin" constant="-3" id="eoM-Rc-PO1"/>
<constraint firstItem="mu1-ck-cFH" firstAttribute="leading" secondItem="9XQ-vB-6gL" secondAttribute="leadingMargin" id="rUI-eR-sxk"/>
<constraint firstItem="mu1-ck-cFH" firstAttribute="centerX" secondItem="9XQ-vB-6gL" secondAttribute="centerX" id="yln-qc-xah"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="nameLabel" destination="qpi-tj-4sQ" id="ZwC-rN-EXY"/>
<outlet property="valueLabel" destination="XZ7-97-d2a" id="CJt-ik-FMr"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="pfI-e5-qb0" id="EMV-FM-Uzm"/>
<outlet property="delegate" destination="pfI-e5-qb0" id="ln7-Pe-Qp3"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cWl-9l-bPW" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1082" y="827"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="P46-ta-yXN">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="7pM-wQ-brU" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="W7d-5T-VE6">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="bcl-fM-S5A"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="bKf-sT-tsf" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="270" y="111"/>
</scene>
</scenes>
</document>
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Foundation
func main(args:[String:Any]) -> [String:Any] {
let NumDays = 2
var filteredForecasts = [[String:Any]]()
#if os(Linux)
if let forecasts = args["forecasts"] as? [Any] {
for day in 0...(NumDays - 1) {
if let forecast = forecasts[day] as? [String:Any] {
var terse = [String:Any]()
terse["dow"] = forecast["dow"]
terse["narrative"] = forecast["narrative"]
terse["min_temp"] = forecast["min_temp"]
terse["max_temp"] = forecast["max_temp"]
filteredForecasts.append(terse)
}
}
}
#else
if let forecasts = args["forecasts"] as? [[String:AnyObject]] {
for day in 0...(NumDays - 1) {
let forecast = forecasts[day] as [String:AnyObject]
var terse = [String:Any]()
terse["dow"] = forecast["dow"]
terse["narrative"] = forecast["narrative"]
terse["min_temp"] = forecast["min_temp"]
terse["max_temp"] = forecast["max_temp"]
filteredForecasts.append(terse)
}
}
#endif
return [ "forecasts": filteredForecasts ]
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</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>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UIKit
class ResultSetCell: UITableViewCell {
@IBOutlet weak var valueLabel: UILabel!
@IBOutlet weak var nameLabel: UILabel!
}
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UIKit
class ResultSetTableController: UITableViewController {
var resultSet: [String: AnyObject]!
var names = [String]()
var values = [String]()
var isComplex = [Bool]()
override func viewDidLoad() {
super.viewDidLoad()
tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableViewAutomaticDimension
navigationItem.title = "Action Results"
reloadTable()
}
func reloadTable() {
names = [String]()
values = [String]()
if let resultSet = resultSet , resultSet.count > 0 {
for (name, value) in resultSet {
names.append(name)
if let value = (value as? String) {
values.append(value)
isComplex.append(false)
} else {
if value is Bool {
if (value as! Bool) == true {
values.append("true")
} else {
values.append("false")
}
isComplex.append(false)
} else if value is NSNumber {
values.append(value.stringValue)
isComplex.append(false)
} else {
do {
let theJSONData = try JSONSerialization.data(
withJSONObject: value ,
options: JSONSerialization.WritingOptions(rawValue: 0))
let theJSONText = NSString(data: theJSONData,
encoding: String.Encoding.ascii.rawValue)
values.append(theJSONText as! String)
isComplex.append(true)
} catch {
print("Error converting value to JSON")
values.append("Unknown type")
isComplex.append(false)
}
}
}
}
}
}
// MARK UITableViewDataSource
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return resultSet.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "resultCell") as! ResultSetCell
cell.nameLabel.text = names[(indexPath as NSIndexPath).row]
cell.valueLabel.text = values[(indexPath as NSIndexPath).row]
if isComplex[(indexPath as NSIndexPath).row] == true {
cell.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
}
return cell
}
}
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Foundation
class SelfSignedNetworkDelegate: NSObject, URLSessionDelegate {
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
}
}
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Foundation
func convertReply(input: [String:AnyObject]) -> [String:Any] {
var output = [String:Any]()
for (key, value) in input {
if let value = value as? [[String: AnyObject]] {
var newValue = [[String:Any]]()
for dict in value {
var newDict = [String:Any]()
for (key2, value2) in dict {
newDict[key2] = value2
}
newValue.append(newDict)
}
output[key] = newValue
}
}
return output
}
func filterForecast(args:[String:Any]) -> [String:Any] {
let NumDays = 2
var filteredForecasts = [[String:Any]]()
if let forecasts = args["forecasts"] as? [[String:Any]] {
for day in 0...(NumDays - 1) {
let forecast = forecasts[day] as [String:Any]
var terse = [String:Any]()
terse["dow"] = forecast["dow"]
terse["narrative"] = forecast["narrative"]
terse["min_temp"] = forecast["min_temp"]
terse["max_temp"] = forecast["max_temp"]
filteredForecasts.append(terse)
}
}
return [ "forecasts": filteredForecasts ]
}
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UIKit
import OpenWhisk
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
@IBOutlet weak var whiskButton: WhiskButton!
@IBOutlet weak var outputText: UITextView!
@IBOutlet weak var statusLabel: UILabel!
// Change to your whisk app key and secret.
let WhiskAppKey: String = "AppKey"
let WhiskAppSecret: String = "AppSecret"
// the URL for Whisk backend
let baseUrl: String? = "https://openwhisk.ng.bluemix.net"
// The action to invoke.
// Choice: specify components
let MyNamespace: String = "whisk.system"
let MyPackage: String? = "util"
let MyWhiskAction: String = "date"
var MyActionParameters: [String:AnyObject]? = nil
let HasResult: Bool = true // true if the action returns a result
var session: URLSession!
let locationManager = CLLocationManager()
var currentLocation: [CLLocation]?
override func viewDidLoad() {
super.viewDidLoad()
// create custom session that allows self-signed certificates
let session = URLSession(configuration: URLSessionConfiguration.default, delegate: SelfSignedNetworkDelegate(), delegateQueue:OperationQueue.main)
// create whisk credentials token
let creds = WhiskCredentials(accessKey: WhiskAppKey,accessToken: WhiskAppSecret)
// Setup action using components
whiskButton.setupWhiskAction(MyWhiskAction, package: MyPackage, namespace: MyNamespace, credentials: creds, hasResult: HasResult, parameters: MyActionParameters, urlSession: session, baseUrl: baseUrl)
// setup location
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
navigationItem.title = "Whisk"
}
@IBAction func whiskButtonPressed(sender: AnyObject) {
// Set latitude and longitude parameters.
if let currentLocation = currentLocation {
MyActionParameters = ["latitude": currentLocation[0].coordinate.latitude as AnyObject, "longitude": currentLocation[0].coordinate.longitude as AnyObject]
}
// Invoke action with parameters.
whiskButton.invokeAction(parameters: MyActionParameters, actionCallback: { reply, error in
if let error = error {
print("Oh no! \(error)")
if case let WhiskError.httpError(description, statusCode) = error {
print("HttpError: \(description) statusCode:\(statusCode)")
}
} else if let reply = reply {
let str = "\(reply)"
print("reply: \(str)")
self.statusLabel.text = "Action \(self.MyNamespace)/\(self.MyWhiskAction) returned \(str.characters.count) characters"
if let result = reply["result"] as? [String:AnyObject] {
self.displayOutput(reply: result)
}
} else {
print("Success")
}
})
}
func displayOutput(reply: [String:AnyObject]) {
if let date = reply["date"] as? String{
self.outputText.text = "The date is \(reformatDate(dateStr: date))"
}
}
// Optional, can be used to display results in a UITableView
func displayResultView(reply: [String: AnyObject]) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "resultSetTable") as! ResultSetTableController
vc.resultSet = reply
self.navigationController?.pushViewController(vc, animated: true)
}
// CLLocationDelegate Functions
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
print("Got location manager authorization status \(status)")
locationManager.startUpdatingLocation()
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
currentLocation = locations
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// Convert string timestamp to a display format
func reformatDate(dateStr: String) -> String {
var newDateStr = dateStr
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
formatter.timeZone = TimeZone(abbreviation: "UTC") //NSTimeZone(name: "UTC")
if let date = formatter.date(from: dateStr) {
formatter.dateFormat = "MMM dd EEEE yyyy HH:mm"
formatter.timeZone = TimeZone(abbreviation: "UTC")
newDateStr = formatter.string(from: date)
}
return newDateStr
}
}
use_frameworks!
target 'OpenWhiskStarterApp' do
platform :ios, '10.0'
pod 'OpenWhisk', :git => 'https://github.com/openwhisk/openwhisk-client-swift.git', :tag => '0.2.1'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment