IDPROD-1437: Identity example app (#148)

Created an "IdentityVerification Example" project to demonstrate how to use the `IdentityVerificationSheet`.
This commit is contained in:
Mel 2021-03-16 21:17:51 -07:00
parent 8e04f89725
commit 16c2d2c28b
11 changed files with 899 additions and 0 deletions

View File

@ -0,0 +1,382 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
E66D20FA25F069C700ED6CA0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66D20F925F069C700ED6CA0 /* AppDelegate.swift */; };
E66D20FC25F069C700ED6CA0 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66D20FB25F069C700ED6CA0 /* SceneDelegate.swift */; };
E66D20FE25F069C700ED6CA0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66D20FD25F069C700ED6CA0 /* ViewController.swift */; };
E66D210125F069C700ED6CA0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E66D20FF25F069C700ED6CA0 /* Main.storyboard */; };
E66D210325F069C800ED6CA0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E66D210225F069C800ED6CA0 /* Assets.xcassets */; };
E66D210625F069C800ED6CA0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E66D210425F069C800ED6CA0 /* LaunchScreen.storyboard */; };
E66D211025F069FB00ED6CA0 /* Stripe.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E66D210F25F069FB00ED6CA0 /* Stripe.framework */; };
E66D211125F069FB00ED6CA0 /* Stripe.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E66D210F25F069FB00ED6CA0 /* Stripe.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
E6A598E425F6E8B8003B4987 /* Stripe3DS2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6A598E325F6E8B8003B4987 /* Stripe3DS2.framework */; };
E6A598E525F6E8B8003B4987 /* Stripe3DS2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E6A598E325F6E8B8003B4987 /* Stripe3DS2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
E66D211225F069FC00ED6CA0 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
E66D211125F069FB00ED6CA0 /* Stripe.framework in Embed Frameworks */,
E6A598E525F6E8B8003B4987 /* Stripe3DS2.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
E66D20F625F069C700ED6CA0 /* IdentityVerification Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "IdentityVerification Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
E66D20F925F069C700ED6CA0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
E66D20FB25F069C700ED6CA0 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
E66D20FD25F069C700ED6CA0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
E66D210025F069C700ED6CA0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
E66D210225F069C800ED6CA0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
E66D210525F069C800ED6CA0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
E66D210725F069C800ED6CA0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E66D210F25F069FB00ED6CA0 /* Stripe.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Stripe.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E6A598E325F6E8B8003B4987 /* Stripe3DS2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Stripe3DS2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
E66D20F325F069C700ED6CA0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E66D211025F069FB00ED6CA0 /* Stripe.framework in Frameworks */,
E6A598E425F6E8B8003B4987 /* Stripe3DS2.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
E66D20ED25F069C700ED6CA0 = {
isa = PBXGroup;
children = (
E66D20F825F069C700ED6CA0 /* IdentityVerification Example */,
E66D20F725F069C700ED6CA0 /* Products */,
E66D210E25F069FB00ED6CA0 /* Frameworks */,
);
sourceTree = "<group>";
};
E66D20F725F069C700ED6CA0 /* Products */ = {
isa = PBXGroup;
children = (
E66D20F625F069C700ED6CA0 /* IdentityVerification Example.app */,
);
name = Products;
sourceTree = "<group>";
};
E66D20F825F069C700ED6CA0 /* IdentityVerification Example */ = {
isa = PBXGroup;
children = (
E66D20F925F069C700ED6CA0 /* AppDelegate.swift */,
E66D20FB25F069C700ED6CA0 /* SceneDelegate.swift */,
E66D20FD25F069C700ED6CA0 /* ViewController.swift */,
E66D20FF25F069C700ED6CA0 /* Main.storyboard */,
E66D210225F069C800ED6CA0 /* Assets.xcassets */,
E66D210425F069C800ED6CA0 /* LaunchScreen.storyboard */,
E66D210725F069C800ED6CA0 /* Info.plist */,
);
path = "IdentityVerification Example";
sourceTree = "<group>";
};
E66D210E25F069FB00ED6CA0 /* Frameworks */ = {
isa = PBXGroup;
children = (
E6A598E325F6E8B8003B4987 /* Stripe3DS2.framework */,
E66D210F25F069FB00ED6CA0 /* Stripe.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
E66D20F525F069C700ED6CA0 /* IdentityVerification Example */ = {
isa = PBXNativeTarget;
buildConfigurationList = E66D210A25F069C800ED6CA0 /* Build configuration list for PBXNativeTarget "IdentityVerification Example" */;
buildPhases = (
E66D20F225F069C700ED6CA0 /* Sources */,
E66D20F325F069C700ED6CA0 /* Frameworks */,
E66D20F425F069C700ED6CA0 /* Resources */,
E66D211225F069FC00ED6CA0 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "IdentityVerification Example";
productName = "IdentityVerification Example";
productReference = E66D20F625F069C700ED6CA0 /* IdentityVerification Example.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
E66D20EE25F069C700ED6CA0 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1240;
TargetAttributes = {
E66D20F525F069C700ED6CA0 = {
CreatedOnToolsVersion = 12.4;
};
};
};
buildConfigurationList = E66D20F125F069C700ED6CA0 /* Build configuration list for PBXProject "IdentityVerification Example" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = E66D20ED25F069C700ED6CA0;
productRefGroup = E66D20F725F069C700ED6CA0 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
E66D20F525F069C700ED6CA0 /* IdentityVerification Example */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
E66D20F425F069C700ED6CA0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E66D210625F069C800ED6CA0 /* LaunchScreen.storyboard in Resources */,
E66D210325F069C800ED6CA0 /* Assets.xcassets in Resources */,
E66D210125F069C700ED6CA0 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
E66D20F225F069C700ED6CA0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E66D20FE25F069C700ED6CA0 /* ViewController.swift in Sources */,
E66D20FA25F069C700ED6CA0 /* AppDelegate.swift in Sources */,
E66D20FC25F069C700ED6CA0 /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
E66D20FF25F069C700ED6CA0 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
E66D210025F069C700ED6CA0 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
E66D210425F069C800ED6CA0 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
E66D210525F069C800ED6CA0 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
E66D210825F069C800ED6CA0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
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 = 14.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
E66D210925F069C800ED6CA0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
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 = 14.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
E66D210B25F069C800ED6CA0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = Y28TH9SHX7;
INFOPLIST_FILE = "IdentityVerification Example/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.stripe.example.IdentityVerification-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
E66D210C25F069C800ED6CA0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = Y28TH9SHX7;
INFOPLIST_FILE = "IdentityVerification Example/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.stripe.example.IdentityVerification-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
E66D20F125F069C700ED6CA0 /* Build configuration list for PBXProject "IdentityVerification Example" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E66D210825F069C800ED6CA0 /* Debug */,
E66D210925F069C800ED6CA0 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E66D210A25F069C800ED6CA0 /* Build configuration list for PBXNativeTarget "IdentityVerification Example" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E66D210B25F069C800ED6CA0 /* Debug */,
E66D210C25F069C800ED6CA0 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = E66D20EE25F069C700ED6CA0 /* Project object */;
}

View File

@ -0,0 +1,36 @@
//
// AppDelegate.swift
// IdentityVerification Example
//
// Created by Mel Ludowise on 3/3/21.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

View File

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</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>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.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="IdentityVerification_Example" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="NUM-z5-BWi">
<rect key="frame" x="145.5" y="433" width="123" height="30"/>
<subviews>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="oXV-29-c3d">
<rect key="frame" x="0.0" y="0.0" width="20" height="30"/>
</activityIndicatorView>
<button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hp2-OI-oTI">
<rect key="frame" x="28" y="0.0" width="95" height="30"/>
<state key="normal" title="Verify Identity"/>
</button>
</subviews>
</stackView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="NUM-z5-BWi" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="aSZ-Q2-1he"/>
<constraint firstItem="NUM-z5-BWi" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="oLR-ti-g9m"/>
</constraints>
</view>
<connections>
<outlet property="activityIndicator" destination="oXV-29-c3d" id="7mM-GO-kd9"/>
<outlet property="verifyButton" destination="hp2-OI-oTI" id="0LE-Z4-fuc"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="139" y="114"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@ -0,0 +1,81 @@
<?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>$(DEVELOPMENT_LANGUAGE)</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>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.stripe.example.identityverification</string>
<key>CFBundleURLSchemes</key>
<array>
<string>identity-verification-example</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>To verify your identity.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</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>

View File

@ -0,0 +1,69 @@
//
// SceneDelegate.swift
// IdentityVerification Example
//
// Created by Mel Ludowise on 3/3/21.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(
_ scene: UIScene,
openURLContexts URLContexts: Set<UIOpenURLContext>
) {
if let urlContext = URLContexts.first {
let url = urlContext.url
// iOS versions older than 14.3 will go through the verification flow
// in a browser that will redirect, then back to the app.
// We're handling this redirect by posting a notification so we know
// when the user has completed the flow in the browser.
if url.host == "verificationComplete" {
NotificationCenter.default.post(name: redirectFromVerificationNotification, object: nil)
}
}
}
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}

View File

@ -0,0 +1,134 @@
//
// ViewController.swift
// IdentityVerification Example
//
// Created by Mel Ludowise on 3/3/21.
//
import UIKit
import Stripe
let redirectFromVerificationNotification = Notification.Name(rawValue: "redirectFromVerificationNotification")
class ViewController: UIViewController {
// Constants
let baseURL = "https://stripe-mobile-identity-verification-example.glitch.me"
let verifyEndpoint = "/create-verification-session"
// Outlets
@IBOutlet weak var verifyButton: UIButton!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
var verificationSheet: IdentityVerificationSheet?
override func viewDidLoad() {
super.viewDidLoad()
// Observe the notification posted by SceneDelegate's URL handler
NotificationCenter.default.addObserver(self, selector: #selector(didReceiveRedirectFromVerificationNotification), name: redirectFromVerificationNotification, object: nil)
activityIndicator.hidesWhenStopped = true
verifyButton.addTarget(self, action: #selector(didTapVerifyButton), for: .touchUpInside)
}
@objc
func didTapVerifyButton() {
requestVerificationSession()
}
@objc
func didReceiveRedirectFromVerificationNotification() {
displayAlert("Finished verification in browser!")
}
func requestVerificationSession() {
// Disable the button while we make the request
updateButtonState(isLoading: true)
// Make request to our verification endpoint
let session = URLSession.shared
let url = URL(string: baseURL + verifyEndpoint)!
// IdentityVerificationSheet is only supported on iOS 14.3
// Tell the server to fallback to using a URL redirect for older versions
var supportsVerificationSheet = false
if #available(iOS 14.3, *) {
supportsVerificationSheet = true
}
let requestBody = try! JSONEncoder().encode([
"client_supports_verification_sheet": supportsVerificationSheet,
])
var urlRequest = URLRequest(url: url)
urlRequest.httpMethod = "POST"
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-type")
urlRequest.httpBody = requestBody
let task = session.dataTask(with: urlRequest) { [weak self] data, response, error in
DispatchQueue.main.async { [weak self] in
// Re-enable button
self?.updateButtonState(isLoading: false)
guard
error == nil,
let data = data,
let responseJson = try? JSONDecoder().decode([String: String].self, from: data)
else {
print(error as Any)
return
}
self?.startVerificationFlow(responseJson: responseJson)
}
}
task.resume()
}
func startVerificationFlow(responseJson: [String: String]) {
if #available(iOS 14.3, *),
let clientSecret = responseJson["client_secret"] {
self.verificationSheet = IdentityVerificationSheet(verificationSessionClientSecret: clientSecret)
self.verificationSheet?.present(
from: self,
completion: { [weak self] result in
switch result {
case .flowCompleted:
self?.displayAlert("Completed!")
case .flowCanceled:
self?.displayAlert("Canceled!")
case .flowFailed(let error):
self?.displayAlert("Failed!")
print(error)
}
})
} else if let verificationURLString = responseJson["url"],
let verificationURL = URL(string: verificationURLString) {
UIApplication.shared.open(verificationURL)
} else {
assertionFailure("Did not receive a valid url or client secret.")
}
}
func updateButtonState(isLoading: Bool) {
// Re-enable button
verifyButton.isEnabled = !isLoading
if isLoading {
activityIndicator.startAnimating()
} else {
activityIndicator.stopAnimating()
}
}
func displayAlert(_ message: String) {
let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert)
let OKAction = UIAlertAction(title: "OK", style: .default) { (action) in
alertController.dismiss(animated: true) {
self.dismiss(animated: true, completion: nil)
}
}
alertController.addAction(OKAction)
present(alertController, animated: true, completion: nil)
}
}

View File

@ -25,6 +25,9 @@
<FileRef
location = "group:Example/Non-Card Payment Examples/Non-Card Payment Examples.xcodeproj">
</FileRef>
<FileRef
location = "group:Example/IdentityVerification Example.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"