Revert "Initial iOS Project"
This reverts commit 74f1a5bde53069f31e08171ef86bc30b6df48a5b.
42
iOS/.gitignore
vendored
@ -1,42 +0,0 @@
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
.DS_Store
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
|
||||
## Other
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
*.xcuserstate
|
||||
*.xcscmblueprint
|
||||
|
||||
*.xcworkspace
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
Pods/
|
||||
|
||||
build
|
||||
Output
|
@ -1,456 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
BA9C6129222F882B00B02D82 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C6128222F882B00B02D82 /* AppDelegate.swift */; };
|
||||
BA9C612B222F882B00B02D82 /* CameraInterfaceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C612A222F882B00B02D82 /* CameraInterfaceViewController.swift */; };
|
||||
BA9C612E222F882B00B02D82 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA9C612C222F882B00B02D82 /* Main.storyboard */; };
|
||||
BA9C6130222F882C00B02D82 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA9C612F222F882C00B02D82 /* Assets.xcassets */; };
|
||||
BA9C6133222F882C00B02D82 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA9C6131222F882C00B02D82 /* LaunchScreen.storyboard */; };
|
||||
BA9C613B222F88B600B02D82 /* CameraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C613A222F88B600B02D82 /* CameraViewController.swift */; };
|
||||
BA9C613D222F965800B02D82 /* Camera.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C613C222F965800B02D82 /* Camera.swift */; };
|
||||
BA9C614D2231E17C00B02D82 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C614C2231E17C00B02D82 /* UIImage+Extensions.swift */; };
|
||||
BA9C61512234667600B02D82 /* MainPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C61502234667600B02D82 /* MainPageViewController.swift */; };
|
||||
BA9C61532234755D00B02D82 /* CameraInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C61522234755D00B02D82 /* CameraInterface.swift */; };
|
||||
BA9C615522348CB900B02D82 /* TextInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C615422348CB900B02D82 /* TextInterface.swift */; };
|
||||
BA9C61582234915700B02D82 /* TextToTextViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C61572234915700B02D82 /* TextToTextViewController.swift */; };
|
||||
BA9C615A2234CC9A00B02D82 /* SketchPadInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C61592234CC9A00B02D82 /* SketchPadInterface.swift */; };
|
||||
BA9C615C2234CE2700B02D82 /* SketchPadToImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C615B2234CE2700B02D82 /* SketchPadToImageViewController.swift */; };
|
||||
BA9C615E2234DB4600B02D82 /* MainTabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9C615D2234DB4600B02D82 /* MainTabBarViewController.swift */; };
|
||||
FA56A3291E9C242D9A59B355 /* Pods_Gradio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0F4AB8C8860E479D08D9B1B /* Pods_Gradio.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0478E5221F843AD4860486D2 /* Pods-Gradio.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Gradio.release.xcconfig"; path = "Pods/Target Support Files/Pods-Gradio/Pods-Gradio.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3DD599F9F02691C494D21AD8 /* Pods-Gradio.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Gradio.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Gradio/Pods-Gradio.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
BA9C6125222F882B00B02D82 /* Gradio.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Gradio.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BA9C6128222F882B00B02D82 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
BA9C612A222F882B00B02D82 /* CameraInterfaceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraInterfaceViewController.swift; sourceTree = "<group>"; };
|
||||
BA9C612D222F882B00B02D82 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
BA9C612F222F882C00B02D82 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
BA9C6132222F882C00B02D82 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
BA9C6134222F882C00B02D82 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
BA9C613A222F88B600B02D82 /* CameraViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraViewController.swift; sourceTree = "<group>"; };
|
||||
BA9C613C222F965800B02D82 /* Camera.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Camera.swift; sourceTree = "<group>"; };
|
||||
BA9C614C2231E17C00B02D82 /* UIImage+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Extensions.swift"; sourceTree = "<group>"; };
|
||||
BA9C61502234667600B02D82 /* MainPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainPageViewController.swift; sourceTree = "<group>"; };
|
||||
BA9C61522234755D00B02D82 /* CameraInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraInterface.swift; sourceTree = "<group>"; };
|
||||
BA9C615422348CB900B02D82 /* TextInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextInterface.swift; sourceTree = "<group>"; };
|
||||
BA9C61572234915700B02D82 /* TextToTextViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextToTextViewController.swift; sourceTree = "<group>"; };
|
||||
BA9C61592234CC9A00B02D82 /* SketchPadInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SketchPadInterface.swift; sourceTree = "<group>"; };
|
||||
BA9C615B2234CE2700B02D82 /* SketchPadToImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SketchPadToImageViewController.swift; sourceTree = "<group>"; };
|
||||
BA9C615D2234DB4600B02D82 /* MainTabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBarViewController.swift; sourceTree = "<group>"; };
|
||||
C0F4AB8C8860E479D08D9B1B /* Pods_Gradio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Gradio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BA9C6122222F882B00B02D82 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FA56A3291E9C242D9A59B355 /* Pods_Gradio.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
5107ACADEAE2E89D7C45766D /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C0F4AB8C8860E479D08D9B1B /* Pods_Gradio.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5DF7B4C66DEE1809778C41DF /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3DD599F9F02691C494D21AD8 /* Pods-Gradio.debug.xcconfig */,
|
||||
0478E5221F843AD4860486D2 /* Pods-Gradio.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA9C611C222F882B00B02D82 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA9C6127222F882B00B02D82 /* Gradio */,
|
||||
BA9C6126222F882B00B02D82 /* Products */,
|
||||
5DF7B4C66DEE1809778C41DF /* Pods */,
|
||||
5107ACADEAE2E89D7C45766D /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA9C6126222F882B00B02D82 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA9C6125222F882B00B02D82 /* Gradio.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA9C6127222F882B00B02D82 /* Gradio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA9C6128222F882B00B02D82 /* AppDelegate.swift */,
|
||||
BA9C615B2234CE2700B02D82 /* SketchPadToImageViewController.swift */,
|
||||
BA9C61572234915700B02D82 /* TextToTextViewController.swift */,
|
||||
BA9C612A222F882B00B02D82 /* CameraInterfaceViewController.swift */,
|
||||
BA9C613A222F88B600B02D82 /* CameraViewController.swift */,
|
||||
BA9C613C222F965800B02D82 /* Camera.swift */,
|
||||
BA9C612C222F882B00B02D82 /* Main.storyboard */,
|
||||
BA9C612F222F882C00B02D82 /* Assets.xcassets */,
|
||||
BA9C6131222F882C00B02D82 /* LaunchScreen.storyboard */,
|
||||
BA9C6134222F882C00B02D82 /* Info.plist */,
|
||||
BA9C614C2231E17C00B02D82 /* UIImage+Extensions.swift */,
|
||||
BA9C61502234667600B02D82 /* MainPageViewController.swift */,
|
||||
BA9C615D2234DB4600B02D82 /* MainTabBarViewController.swift */,
|
||||
BA9C61562234904F00B02D82 /* Interfaces */,
|
||||
);
|
||||
path = Gradio;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA9C61562234904F00B02D82 /* Interfaces */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA9C61522234755D00B02D82 /* CameraInterface.swift */,
|
||||
BA9C615422348CB900B02D82 /* TextInterface.swift */,
|
||||
BA9C61592234CC9A00B02D82 /* SketchPadInterface.swift */,
|
||||
);
|
||||
path = Interfaces;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
BA9C6124222F882B00B02D82 /* Gradio */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = BA9C6137222F882C00B02D82 /* Build configuration list for PBXNativeTarget "Gradio" */;
|
||||
buildPhases = (
|
||||
7FCDB3521EE8259A582818B7 /* [CP] Check Pods Manifest.lock */,
|
||||
BA9C6121222F882B00B02D82 /* Sources */,
|
||||
BA9C6122222F882B00B02D82 /* Frameworks */,
|
||||
BA9C6123222F882B00B02D82 /* Resources */,
|
||||
1F4F92E2906F89435ADF179A /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Gradio;
|
||||
productName = Gradio;
|
||||
productReference = BA9C6125222F882B00B02D82 /* Gradio.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
BA9C611D222F882B00B02D82 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1010;
|
||||
LastUpgradeCheck = 1010;
|
||||
ORGANIZATIONNAME = Gradio;
|
||||
TargetAttributes = {
|
||||
BA9C6124222F882B00B02D82 = {
|
||||
CreatedOnToolsVersion = 10.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = BA9C6120222F882B00B02D82 /* Build configuration list for PBXProject "Gradio" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = BA9C611C222F882B00B02D82;
|
||||
productRefGroup = BA9C6126222F882B00B02D82 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
BA9C6124222F882B00B02D82 /* Gradio */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
BA9C6123222F882B00B02D82 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BA9C6133222F882C00B02D82 /* LaunchScreen.storyboard in Resources */,
|
||||
BA9C6130222F882C00B02D82 /* Assets.xcassets in Resources */,
|
||||
BA9C612E222F882B00B02D82 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
1F4F92E2906F89435ADF179A /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-Gradio/Pods-Gradio-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Starscream.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Gradio/Pods-Gradio-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
7FCDB3521EE8259A582818B7 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Gradio-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
BA9C6121222F882B00B02D82 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BA9C612B222F882B00B02D82 /* CameraInterfaceViewController.swift in Sources */,
|
||||
BA9C6129222F882B00B02D82 /* AppDelegate.swift in Sources */,
|
||||
BA9C61532234755D00B02D82 /* CameraInterface.swift in Sources */,
|
||||
BA9C615A2234CC9A00B02D82 /* SketchPadInterface.swift in Sources */,
|
||||
BA9C614D2231E17C00B02D82 /* UIImage+Extensions.swift in Sources */,
|
||||
BA9C615522348CB900B02D82 /* TextInterface.swift in Sources */,
|
||||
BA9C613D222F965800B02D82 /* Camera.swift in Sources */,
|
||||
BA9C61582234915700B02D82 /* TextToTextViewController.swift in Sources */,
|
||||
BA9C615C2234CE2700B02D82 /* SketchPadToImageViewController.swift in Sources */,
|
||||
BA9C615E2234DB4600B02D82 /* MainTabBarViewController.swift in Sources */,
|
||||
BA9C61512234667600B02D82 /* MainPageViewController.swift in Sources */,
|
||||
BA9C613B222F88B600B02D82 /* CameraViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
BA9C612C222F882B00B02D82 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
BA9C612D222F882B00B02D82 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BA9C6131222F882C00B02D82 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
BA9C6132222F882C00B02D82 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
BA9C6135222F882C00B02D82 /* 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_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;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
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 = 12.1;
|
||||
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;
|
||||
};
|
||||
BA9C6136222F882C00B02D82 /* 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_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;
|
||||
CODE_SIGN_IDENTITY = "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 = 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 = 12.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BA9C6138222F882C00B02D82 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 3DD599F9F02691C494D21AD8 /* Pods-Gradio.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = RHW8FBGSTX;
|
||||
INFOPLIST_FILE = Gradio/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = app.gradio.Gradio;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BA9C6139222F882C00B02D82 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 0478E5221F843AD4860486D2 /* Pods-Gradio.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = RHW8FBGSTX;
|
||||
INFOPLIST_FILE = Gradio/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = app.gradio.Gradio;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
BA9C6120222F882B00B02D82 /* Build configuration list for PBXProject "Gradio" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BA9C6135222F882C00B02D82 /* Debug */,
|
||||
BA9C6136222F882C00B02D82 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
BA9C6137222F882C00B02D82 /* Build configuration list for PBXNativeTarget "Gradio" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BA9C6138222F882C00B02D82 /* Debug */,
|
||||
BA9C6139222F882C00B02D82 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = BA9C611D222F882B00B02D82 /* Project object */;
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/5/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: 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 invalidate graphics rendering callbacks. 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 active 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:.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,98 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"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" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_flash_off.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_flash_off_2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_flash_off_3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 435 B |
@ -1,26 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_flash_on.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_flash_on_2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_flash_on_3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 294 B |
@ -1,26 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_camera_front.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_camera_front_2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_camera_front_3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 313 B |
Before Width: | Height: | Size: 435 B |
@ -1,15 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "pencil.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_photo_camera.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_photo_camera_2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_photo_camera_3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 643 B |
@ -1,26 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_camera_rear.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_camera_rear_2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_camera_rear_3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 364 B |
@ -1,23 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Redo Button.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Redo Button@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Redo Button@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 10 KiB |
@ -1,15 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "letter-t-icon-png-24.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "TapForCamera.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Screen Shot 2019-03-09 at 7.56.56 PM.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 13 KiB |
@ -1,26 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_videocam.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_videocam_2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_videocam_3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 224 B |
@ -1,23 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "X Button.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "X Button@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "X Button@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 58 KiB |
@ -1,25 +0,0 @@
|
||||
<?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" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<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>
|
@ -1,162 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="sYu-Nc-PDG">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Main Tab Bar View Controller-->
|
||||
<scene sceneID="QVv-Np-ccV">
|
||||
<objects>
|
||||
<tabBarController id="sYu-Nc-PDG" customClass="MainTabBarViewController" customModule="Gradio" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="pXk-cv-hBG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tabBar>
|
||||
</tabBarController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="bxM-4L-LN2" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1526" y="125"/>
|
||||
</scene>
|
||||
<!--Main Page View Controller-->
|
||||
<scene sceneID="Pkc-lb-rCB">
|
||||
<objects>
|
||||
<pageViewController autoresizesArchivedViewToFullSize="NO" transitionStyle="scroll" navigationOrientation="horizontal" spineLocation="none" id="vLK-VU-Y5U" customClass="MainPageViewController" customModule="Gradio" customModuleProvider="target" sceneMemberID="viewController"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="TdD-Nf-zZn" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-722" y="125"/>
|
||||
</scene>
|
||||
<!--Camera View Controller-->
|
||||
<scene sceneID="9Fu-Yf-pgR">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="CameraViewController" id="hIc-rq-30R" customClass="CameraViewController" customModule="Gradio" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="bTp-sn-Hsn">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MBk-nR-zfY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Fck-Yn-xZT">
|
||||
<rect key="frame" x="315" y="16" width="44" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="44" id="VdR-gr-AYM"/>
|
||||
<constraint firstAttribute="height" constant="44" id="Vj0-cg-exu"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<state key="normal" image="Flash Off Icon"/>
|
||||
<connections>
|
||||
<action selector="toggleFlash:" destination="hIc-rq-30R" eventType="touchUpInside" id="H0P-2n-1iM"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jTP-5r-4ef">
|
||||
<rect key="frame" x="315" y="60" width="44" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="44" id="2WI-Wf-hB3"/>
|
||||
<constraint firstAttribute="height" constant="44" id="ui6-T6-jcg"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<state key="normal" image="Rear Camera Icon"/>
|
||||
<connections>
|
||||
<action selector="switchCameras:" destination="hIc-rq-30R" eventType="touchUpInside" id="CmV-p6-abs"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eL1-6X-cAM">
|
||||
<rect key="frame" x="16" y="563" width="44" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="0u5-iQ-H6o"/>
|
||||
<constraint firstAttribute="width" constant="44" id="CtD-k7-QlQ"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<state key="normal" image="Photo Camera Icon"/>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ATV-FX-c18">
|
||||
<rect key="frame" x="16" y="607" width="44" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="73u-gE-CTA"/>
|
||||
<constraint firstAttribute="width" constant="44" id="FcB-HH-kca"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<state key="normal" image="Video Camera Icon"/>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MOj-8Q-AbM">
|
||||
<rect key="frame" x="16" y="16" width="24" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="24" id="iPD-ew-2RV"/>
|
||||
<constraint firstAttribute="height" constant="24" id="jaE-ML-UUN"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<state key="normal" image="X Button"/>
|
||||
<connections>
|
||||
<action selector="xButtonPressed:" destination="hIc-rq-30R" eventType="touchUpInside" id="QIo-hE-NAA"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="ATV-FX-c18" firstAttribute="leading" secondItem="MBk-nR-zfY" secondAttribute="leading" constant="16" id="6qk-1o-xfz"/>
|
||||
<constraint firstItem="Fck-Yn-xZT" firstAttribute="top" secondItem="MBk-nR-zfY" secondAttribute="top" constant="16" id="BqM-Ja-pMa"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jTP-5r-4ef" secondAttribute="trailing" constant="16" id="KLd-bx-dpO"/>
|
||||
<constraint firstItem="ATV-FX-c18" firstAttribute="top" secondItem="eL1-6X-cAM" secondAttribute="bottom" id="M1o-fK-V44"/>
|
||||
<constraint firstItem="eL1-6X-cAM" firstAttribute="leading" secondItem="MBk-nR-zfY" secondAttribute="leading" constant="16" id="bNH-WM-gz1"/>
|
||||
<constraint firstItem="MOj-8Q-AbM" firstAttribute="leading" secondItem="MBk-nR-zfY" secondAttribute="leading" constant="16" id="bY3-8I-cMX"/>
|
||||
<constraint firstItem="jTP-5r-4ef" firstAttribute="top" secondItem="Fck-Yn-xZT" secondAttribute="bottom" id="bZi-8g-2J2"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ATV-FX-c18" secondAttribute="bottom" constant="16" id="cLq-A6-bFU"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Fck-Yn-xZT" secondAttribute="trailing" constant="16" id="i1q-9P-Vw6"/>
|
||||
<constraint firstItem="ATV-FX-c18" firstAttribute="top" secondItem="eL1-6X-cAM" secondAttribute="bottom" id="kAh-gN-ulo"/>
|
||||
<constraint firstItem="MOj-8Q-AbM" firstAttribute="top" secondItem="MBk-nR-zfY" secondAttribute="top" constant="16" id="puc-xU-Ys6"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Oz1-FL-Van">
|
||||
<rect key="frame" x="160" y="596" width="55" height="55"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="55" id="6MT-K4-52V"/>
|
||||
<constraint firstAttribute="width" constant="55" id="vWL-vc-GXc"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<action selector="captureImage:" destination="hIc-rq-30R" eventType="touchUpInside" id="1zJ-U1-zRf"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Oz1-FL-Van" firstAttribute="centerX" secondItem="1Vs-cK-D2E" secondAttribute="centerX" id="CjM-ne-036"/>
|
||||
<constraint firstItem="MBk-nR-zfY" firstAttribute="leading" secondItem="1Vs-cK-D2E" secondAttribute="leading" id="DE7-5q-v3R"/>
|
||||
<constraint firstItem="1Vs-cK-D2E" firstAttribute="trailing" secondItem="MBk-nR-zfY" secondAttribute="trailing" id="LKU-Ot-MeA"/>
|
||||
<constraint firstItem="MBk-nR-zfY" firstAttribute="top" secondItem="bTp-sn-Hsn" secondAttribute="top" id="hw6-kW-5jZ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="MBk-nR-zfY" secondAttribute="bottom" id="pRQ-eU-B7K"/>
|
||||
<constraint firstItem="1Vs-cK-D2E" firstAttribute="bottom" secondItem="Oz1-FL-Van" secondAttribute="bottom" constant="16" id="tbH-lt-oEB"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="1Vs-cK-D2E"/>
|
||||
</view>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="captureButton" destination="Oz1-FL-Van" id="8qT-D0-6lm"/>
|
||||
<outlet property="capturePreviewView" destination="MBk-nR-zfY" id="dR9-DK-UmQ"/>
|
||||
<outlet property="photoModeButton" destination="eL1-6X-cAM" id="epL-Kp-cdZ"/>
|
||||
<outlet property="toggleCameraButton" destination="jTP-5r-4ef" id="cHu-TE-nQD"/>
|
||||
<outlet property="toggleFlashButton" destination="Fck-Yn-xZT" id="NJU-HD-HnI"/>
|
||||
<outlet property="videoModeButton" destination="ATV-FX-c18" id="N1q-x0-Blb"/>
|
||||
<outlet property="xButton" destination="MOj-8Q-AbM" id="Y67-N8-3iJ"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="w7B-10-Ns0" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="118" y="125"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Flash Off Icon" width="48" height="48"/>
|
||||
<image name="Photo Camera Icon" width="48" height="48"/>
|
||||
<image name="Rear Camera Icon" width="48" height="48"/>
|
||||
<image name="Video Camera Icon" width="48" height="48"/>
|
||||
<image name="X Button" width="512" height="512"/>
|
||||
</resources>
|
||||
</document>
|
@ -1,222 +0,0 @@
|
||||
//
|
||||
// Camera.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/5/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import AVFoundation
|
||||
|
||||
class Camera: NSObject {
|
||||
var captureSession: AVCaptureSession?
|
||||
|
||||
var currentCameraPosition: CameraPosition?
|
||||
|
||||
var frontCamera: AVCaptureDevice?
|
||||
var frontCameraInput: AVCaptureDeviceInput?
|
||||
|
||||
var photoOutput: AVCapturePhotoOutput?
|
||||
|
||||
var rearCamera: AVCaptureDevice?
|
||||
var rearCameraInput: AVCaptureDeviceInput?
|
||||
|
||||
var previewLayer: AVCaptureVideoPreviewLayer?
|
||||
|
||||
var flashMode = AVCaptureDevice.FlashMode.off
|
||||
var photoCaptureCompletionBlock: ((UIImage?, Error?) -> Void)?
|
||||
}
|
||||
|
||||
extension Camera {
|
||||
func prepare(completionHandler: @escaping (Error?) -> Void) {
|
||||
func createCaptureSession() {
|
||||
self.captureSession = AVCaptureSession()
|
||||
}
|
||||
|
||||
func configureCaptureDevices() throws {
|
||||
|
||||
let session = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera], mediaType: AVMediaType.video, position: .unspecified)
|
||||
let cameras = session.devices.compactMap { $0 }
|
||||
guard !cameras.isEmpty else { throw CameraError.noCamerasAvailable }
|
||||
|
||||
for camera in cameras {
|
||||
if camera.position == .front {
|
||||
self.frontCamera = camera
|
||||
}
|
||||
|
||||
if camera.position == .back {
|
||||
self.rearCamera = camera
|
||||
|
||||
try camera.lockForConfiguration()
|
||||
camera.focusMode = .continuousAutoFocus
|
||||
camera.unlockForConfiguration()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func configureDeviceInputs() throws {
|
||||
guard let captureSession = self.captureSession else { throw CameraError.captureSessionIsMissing }
|
||||
|
||||
if let rearCamera = self.rearCamera {
|
||||
self.rearCameraInput = try AVCaptureDeviceInput(device: rearCamera)
|
||||
|
||||
if captureSession.canAddInput(self.rearCameraInput!) { captureSession.addInput(self.rearCameraInput!) }
|
||||
|
||||
self.currentCameraPosition = .rear
|
||||
}
|
||||
|
||||
else if let frontCamera = self.frontCamera {
|
||||
self.frontCameraInput = try AVCaptureDeviceInput(device: frontCamera)
|
||||
|
||||
if captureSession.canAddInput(self.frontCameraInput!) { captureSession.addInput(self.frontCameraInput!) }
|
||||
else { throw CameraError.inputsAreInvalid }
|
||||
|
||||
self.currentCameraPosition = .front
|
||||
}
|
||||
|
||||
else { throw CameraError.noCamerasAvailable }
|
||||
}
|
||||
|
||||
func configurePhotoOutput() throws {
|
||||
guard let captureSession = self.captureSession else { throw CameraError.captureSessionIsMissing }
|
||||
|
||||
self.photoOutput = AVCapturePhotoOutput()
|
||||
self.photoOutput!.setPreparedPhotoSettingsArray([AVCapturePhotoSettings(format: [AVVideoCodecKey : AVVideoCodecType.jpeg])], completionHandler: nil)
|
||||
|
||||
if captureSession.canAddOutput(self.photoOutput!) { captureSession.addOutput(self.photoOutput!) }
|
||||
captureSession.startRunning()
|
||||
}
|
||||
|
||||
DispatchQueue(label: "prepare").async {
|
||||
do {
|
||||
createCaptureSession()
|
||||
try configureCaptureDevices()
|
||||
try configureDeviceInputs()
|
||||
try configurePhotoOutput()
|
||||
}
|
||||
|
||||
catch {
|
||||
DispatchQueue.main.async {
|
||||
completionHandler(error)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
completionHandler(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func displayPreview(on view: UIView) throws {
|
||||
guard let captureSession = self.captureSession, captureSession.isRunning else { throw CameraError.captureSessionIsMissing }
|
||||
|
||||
self.previewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
|
||||
self.previewLayer?.videoGravity = AVLayerVideoGravity.resizeAspectFill
|
||||
self.previewLayer?.connection?.videoOrientation = .portrait
|
||||
|
||||
view.layer.insertSublayer(self.previewLayer!, at: 0)
|
||||
self.previewLayer?.frame = view.frame
|
||||
}
|
||||
|
||||
func switchCameras() throws {
|
||||
guard let currentCameraPosition = currentCameraPosition, let captureSession = self.captureSession, captureSession.isRunning else { throw CameraError.captureSessionIsMissing }
|
||||
|
||||
captureSession.beginConfiguration()
|
||||
|
||||
func switchToFrontCamera() throws {
|
||||
|
||||
guard let rearCameraInput = self.rearCameraInput, captureSession.inputs.contains(rearCameraInput),
|
||||
let frontCamera = self.frontCamera else { throw CameraError.invalidOperation }
|
||||
|
||||
self.frontCameraInput = try AVCaptureDeviceInput(device: frontCamera)
|
||||
|
||||
captureSession.removeInput(rearCameraInput)
|
||||
|
||||
if captureSession.canAddInput(self.frontCameraInput!) {
|
||||
captureSession.addInput(self.frontCameraInput!)
|
||||
|
||||
self.currentCameraPosition = .front
|
||||
}
|
||||
|
||||
else {
|
||||
throw CameraError.invalidOperation
|
||||
}
|
||||
}
|
||||
|
||||
func switchToRearCamera() throws {
|
||||
|
||||
guard let frontCameraInput = self.frontCameraInput, captureSession.inputs.contains(frontCameraInput),
|
||||
let rearCamera = self.rearCamera else { throw CameraError.invalidOperation }
|
||||
|
||||
self.rearCameraInput = try AVCaptureDeviceInput(device: rearCamera)
|
||||
|
||||
captureSession.removeInput(frontCameraInput)
|
||||
|
||||
if captureSession.canAddInput(self.rearCameraInput!) {
|
||||
captureSession.addInput(self.rearCameraInput!)
|
||||
|
||||
self.currentCameraPosition = .rear
|
||||
}
|
||||
|
||||
else { throw CameraError.invalidOperation }
|
||||
}
|
||||
|
||||
switch currentCameraPosition {
|
||||
case .front:
|
||||
try switchToRearCamera()
|
||||
|
||||
case .rear:
|
||||
try switchToFrontCamera()
|
||||
}
|
||||
|
||||
captureSession.commitConfiguration()
|
||||
}
|
||||
|
||||
func captureImage(completion: @escaping (UIImage?, Error?) -> Void) {
|
||||
guard let captureSession = captureSession, captureSession.isRunning else { completion(nil, CameraError.captureSessionIsMissing); return }
|
||||
|
||||
let settings = AVCapturePhotoSettings()
|
||||
settings.flashMode = self.flashMode
|
||||
|
||||
self.photoOutput?.capturePhoto(with: settings, delegate: self)
|
||||
self.photoCaptureCompletionBlock = completion
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Camera: AVCapturePhotoCaptureDelegate {
|
||||
public func photoOutput(_ captureOutput: AVCapturePhotoOutput, didFinishProcessingPhoto photoSampleBuffer: CMSampleBuffer?, previewPhoto previewPhotoSampleBuffer: CMSampleBuffer?,
|
||||
resolvedSettings: AVCaptureResolvedPhotoSettings, bracketSettings: AVCaptureBracketedStillImageSettings?, error: Swift.Error?) {
|
||||
if let error = error { self.photoCaptureCompletionBlock?(nil, error) }
|
||||
|
||||
else if let buffer = photoSampleBuffer, let data = AVCapturePhotoOutput.jpegPhotoDataRepresentation(forJPEGSampleBuffer: buffer, previewPhotoSampleBuffer: nil),
|
||||
let image = UIImage(data: data) {
|
||||
|
||||
self.photoCaptureCompletionBlock?(image, nil)
|
||||
}
|
||||
|
||||
else {
|
||||
self.photoCaptureCompletionBlock?(nil, CameraError.unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Camera {
|
||||
enum CameraError: Swift.Error {
|
||||
case captureSessionAlreadyRunning
|
||||
case captureSessionIsMissing
|
||||
case inputsAreInvalid
|
||||
case invalidOperation
|
||||
case noCamerasAvailable
|
||||
case unknown
|
||||
}
|
||||
|
||||
public enum CameraPosition {
|
||||
case front
|
||||
case rear
|
||||
}
|
||||
}
|
||||
|
@ -1,120 +0,0 @@
|
||||
//
|
||||
// CameraInterfaceViewController.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/5/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Photos
|
||||
import Starscream
|
||||
|
||||
class CameraInterfaceViewController: UIViewController, WebSocketDelegate {
|
||||
|
||||
var titleImageView: UIImageView = UIImageView()
|
||||
var cameraViewController: CameraViewController?
|
||||
var preview: UIImageView = UIImageView()
|
||||
var outputTextView: UITextView = UITextView()
|
||||
var socket: WebSocket = WebSocket(url: URL(string: "ws://c3f3ea66.ngrok.io")!)
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.view.backgroundColor = UIColor.white
|
||||
|
||||
titleImageView.image = UIImage(named: "Title Image")
|
||||
titleImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.view.addSubview(titleImageView)
|
||||
titleImageView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 10.0).isActive = true
|
||||
titleImageView.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.5).isActive = true
|
||||
titleImageView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.08).isActive = true
|
||||
titleImageView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
|
||||
|
||||
let stackView = UIStackView()
|
||||
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.view.addSubview(stackView)
|
||||
stackView.distribution = .equalSpacing
|
||||
stackView.alignment = .fill
|
||||
stackView.axis = .vertical
|
||||
stackView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.8).isActive = true
|
||||
stackView.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.8).isActive = true
|
||||
stackView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
|
||||
stackView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor).isActive = true
|
||||
|
||||
let tapForCameraImage = UIImage(named: "TapForCamera")
|
||||
preview = UIImageView(image: tapForCameraImage)
|
||||
preview.translatesAutoresizingMaskIntoConstraints = false
|
||||
preview.contentMode = .scaleAspectFit
|
||||
stackView.addArrangedSubview(preview)
|
||||
preview.heightAnchor.constraint(equalTo: stackView.heightAnchor, multiplier: 0.45).isActive = true
|
||||
preview.widthAnchor.constraint(equalTo: stackView.widthAnchor).isActive = true
|
||||
|
||||
outputTextView = UITextView()
|
||||
outputTextView.translatesAutoresizingMaskIntoConstraints = false
|
||||
outputTextView.backgroundColor = UIColor(red: 0.72, green: 0.72, blue: 0.72, alpha: 1.0)
|
||||
outputTextView.isEditable = false
|
||||
outputTextView.text = "OUTPUT"
|
||||
outputTextView.textColor = UIColor.darkGray
|
||||
outputTextView.font = UIFont(name: "ArialMT", size: 24)
|
||||
stackView.addArrangedSubview(outputTextView)
|
||||
outputTextView.heightAnchor.constraint(equalTo: stackView.heightAnchor, multiplier: 0.45).isActive = true
|
||||
outputTextView.widthAnchor.constraint(equalTo: stackView.widthAnchor).isActive = true
|
||||
|
||||
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
cameraViewController = storyBoard.instantiateViewController(withIdentifier: "CameraViewController") as? CameraViewController
|
||||
|
||||
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(imageTapped(tapGestureRecognizer:)))
|
||||
preview.isUserInteractionEnabled = true
|
||||
preview.addGestureRecognizer(tapGestureRecognizer)
|
||||
|
||||
updatePreviewWithCapturedImage()
|
||||
setupWebSocket()
|
||||
}
|
||||
|
||||
@objc func imageTapped(tapGestureRecognizer: UITapGestureRecognizer) {
|
||||
// let cameraInterfaceViewController = CameraInterfaceViewController()
|
||||
// self.navigationController?.pushViewController(cameraInterfaceViewController, animated: true)
|
||||
guard let cameraInterfaceViewController = cameraViewController else { return }
|
||||
self.present(cameraInterfaceViewController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func updatePreviewWithCapturedImage() {
|
||||
guard let cameraViewController = cameraViewController else { return }
|
||||
cameraViewController.imageCaptureCompletionBlock = { image in
|
||||
DispatchQueue.main.async {
|
||||
self.preview.image = image
|
||||
self.preview.setNeedsDisplay()
|
||||
self.preview.setNeedsLayout()
|
||||
}
|
||||
let resizedImage = image.resizeImage(targetSize: CGSize(width: 360, height: 360))
|
||||
let imageData: NSData = resizedImage.pngData()! as NSData
|
||||
let strBase64 = imageData.base64EncodedString(options: .lineLength64Characters)
|
||||
let fullBase64String = "data:image/png;base64,\(strBase64))"
|
||||
self.socket.write(string: fullBase64String)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func setupWebSocket() {
|
||||
socket.delegate = self
|
||||
socket.connect()
|
||||
}
|
||||
|
||||
func websocketDidConnect(socket: WebSocketClient) {
|
||||
print("Web Socket Connected!")
|
||||
}
|
||||
|
||||
func websocketDidDisconnect(socket: WebSocketClient, error: Error?) {
|
||||
print("Web Socket Disconnected: ", error.debugDescription)
|
||||
}
|
||||
|
||||
func websocketDidReceiveMessage(socket: WebSocketClient, text: String) {
|
||||
print("Web Socket received message!")
|
||||
outputTextView.text = "Text Recieved: " + text
|
||||
}
|
||||
|
||||
func websocketDidReceiveData(socket: WebSocketClient, data: Data) {
|
||||
print("Web Socket received data!")
|
||||
outputTextView.text = "Data Recieved: " + data.base64EncodedString()
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
//
|
||||
// CameraViewController.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/5/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Photos
|
||||
|
||||
class CameraViewController: UIViewController {
|
||||
|
||||
@IBOutlet fileprivate var captureButton: UIButton!
|
||||
|
||||
///Displays a preview of the video output generated by the device's cameras.
|
||||
@IBOutlet fileprivate var capturePreviewView: UIView!
|
||||
|
||||
///Allows the user to put the camera in photo mode.
|
||||
@IBOutlet fileprivate var photoModeButton: UIButton!
|
||||
@IBOutlet fileprivate var toggleCameraButton: UIButton!
|
||||
@IBOutlet fileprivate var toggleFlashButton: UIButton!
|
||||
|
||||
///Allows the user to put the camera in video mode.
|
||||
@IBOutlet fileprivate var videoModeButton: UIButton!
|
||||
@IBOutlet var xButton: UIButton!
|
||||
|
||||
let camera = Camera()
|
||||
|
||||
var imageCaptureCompletionBlock: ((_ image: UIImage) -> ())?
|
||||
|
||||
override var prefersStatusBarHidden: Bool { return true }
|
||||
}
|
||||
|
||||
extension CameraViewController {
|
||||
override func viewDidLoad() {
|
||||
if AVCaptureDevice.authorizationStatus(for: AVMediaType.video) == AVAuthorizationStatus.authorized {
|
||||
configurecamera()
|
||||
} else {
|
||||
AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { (granted: Bool) -> Void in
|
||||
if granted == true {
|
||||
self.configurecamera()
|
||||
} else {
|
||||
print("User rejected camera access")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func styleCaptureButton() {
|
||||
captureButton.layer.borderColor = UIColor.black.cgColor
|
||||
captureButton.layer.borderWidth = 2
|
||||
|
||||
captureButton.layer.cornerRadius = min(captureButton.frame.width, captureButton.frame.height) / 2
|
||||
}
|
||||
|
||||
styleCaptureButton()
|
||||
|
||||
}
|
||||
|
||||
func configurecamera() {
|
||||
camera.prepare {(error) in
|
||||
if let error = error {
|
||||
print(error)
|
||||
}
|
||||
|
||||
try? self.camera.displayPreview(on: self.capturePreviewView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension CameraViewController {
|
||||
|
||||
|
||||
@IBAction func toggleFlash(_ sender: UIButton) {
|
||||
if camera.flashMode == .on {
|
||||
camera.flashMode = .off
|
||||
toggleFlashButton.setImage(#imageLiteral(resourceName: "Flash Off Icon"), for: .normal)
|
||||
}
|
||||
|
||||
else {
|
||||
camera.flashMode = .on
|
||||
toggleFlashButton.setImage(#imageLiteral(resourceName: "Flash On Icon"), for: .normal)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func switchCameras(_ sender: UIButton) {
|
||||
do {
|
||||
try camera.switchCameras()
|
||||
}
|
||||
|
||||
catch {
|
||||
print(error)
|
||||
}
|
||||
|
||||
switch camera.currentCameraPosition {
|
||||
case .some(.front):
|
||||
toggleCameraButton.setImage(#imageLiteral(resourceName: "Front Camera Icon"), for: .normal)
|
||||
|
||||
case .some(.rear):
|
||||
toggleCameraButton.setImage(#imageLiteral(resourceName: "Rear Camera Icon"), for: .normal)
|
||||
|
||||
case .none:
|
||||
return
|
||||
}
|
||||
}
|
||||
//next do completion block for view controller class
|
||||
@IBAction func captureImage(_ sender: UIButton) {
|
||||
camera.captureImage {(image, error) in
|
||||
guard let image = image else {
|
||||
print(error ?? "Image capture error")
|
||||
return
|
||||
}
|
||||
|
||||
self.imageCaptureCompletionBlock?(image)
|
||||
|
||||
try? PHPhotoLibrary.shared().performChangesAndWait {
|
||||
PHAssetChangeRequest.creationRequestForAsset(from: image)
|
||||
}
|
||||
// self.captureButton.setImage(UIImage(named: "Redo Button"), for: .normal)
|
||||
self.dismiss(animated: false, completion: {
|
||||
//dismissed
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func xButtonPressed(_ sender: Any) {
|
||||
self.dismiss(animated: true)
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?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>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) camera use</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>$(PRODUCT_NAME) photo use</string>
|
||||
<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>
|
@ -1,15 +0,0 @@
|
||||
//
|
||||
// CameraInterface.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/9/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class CameraInterface: UIView {
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
//
|
||||
// SketchPadInterface.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/9/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SketchPadInterface: UIView {
|
||||
|
||||
let interfaceType: InterfaceType?
|
||||
var mainImageView: UIImageView = UIImageView()
|
||||
var tempImageView: UIImageView = UIImageView()
|
||||
|
||||
var lastPoint = CGPoint.zero
|
||||
var color = UIColor.black
|
||||
var brushWidth: CGFloat = 10.0
|
||||
var opacity: CGFloat = 1.0
|
||||
var swiped = false
|
||||
|
||||
init(interfaceType: InterfaceType) {
|
||||
self.interfaceType = interfaceType
|
||||
super.init(frame: CGRect.zero)
|
||||
setupView()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func setupView() {
|
||||
self.addSubview(mainImageView)
|
||||
// self.isExclusiveTouch = true
|
||||
mainImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
mainImageView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||
mainImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
|
||||
mainImageView.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
|
||||
mainImageView.trailingAnchor.constraint(equalTo: self.trailingAnchor).isActive = true
|
||||
|
||||
self.addSubview(tempImageView)
|
||||
tempImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
tempImageView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||
tempImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
|
||||
tempImageView.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
|
||||
tempImageView.trailingAnchor.constraint(equalTo: self.trailingAnchor).isActive = true
|
||||
|
||||
}
|
||||
|
||||
func drawLine(from fromPoint: CGPoint, to toPoint: CGPoint) {
|
||||
UIGraphicsBeginImageContext(self.frame.size)
|
||||
guard let context = UIGraphicsGetCurrentContext() else {
|
||||
return
|
||||
}
|
||||
tempImageView.image?.draw(in: self.bounds)
|
||||
|
||||
context.move(to: fromPoint)
|
||||
context.addLine(to: toPoint)
|
||||
|
||||
context.setLineCap(.round)
|
||||
context.setBlendMode(.normal)
|
||||
context.setLineWidth(brushWidth)
|
||||
context.setStrokeColor(color.cgColor)
|
||||
|
||||
context.strokePath()
|
||||
|
||||
tempImageView.image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
tempImageView.alpha = opacity
|
||||
|
||||
UIGraphicsEndImageContext()
|
||||
}
|
||||
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
guard let touch = touches.first else {
|
||||
return
|
||||
}
|
||||
swiped = false
|
||||
lastPoint = touch.location(in: self)
|
||||
}
|
||||
|
||||
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
guard let touch = touches.first else {
|
||||
return
|
||||
}
|
||||
swiped = true
|
||||
let currentPoint = touch.location(in: self)
|
||||
drawLine(from: lastPoint, to: currentPoint)
|
||||
|
||||
lastPoint = currentPoint
|
||||
}
|
||||
|
||||
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
if !swiped {
|
||||
// draw a single point
|
||||
drawLine(from: lastPoint, to: lastPoint)
|
||||
}
|
||||
|
||||
// Merge tempImageView into mainImageView
|
||||
UIGraphicsBeginImageContext(mainImageView.frame.size)
|
||||
mainImageView.image?.draw(in: self.bounds, blendMode: .normal, alpha: 1.0)
|
||||
tempImageView.image?.draw(in: self.bounds, blendMode: .normal, alpha: opacity)
|
||||
mainImageView.image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
tempImageView.image = nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - SettingsViewControllerDelegate
|
||||
|
||||
//extension SketchPadInterface: SettingsViewControllerDelegate {
|
||||
// func settingsViewControllerFinished(_ settingsViewController: SettingsViewController) {
|
||||
// brushWidth = settingsViewController.brush
|
||||
// opacity = settingsViewController.opacity
|
||||
// color = UIColor(red: settingsViewController.red,
|
||||
// green: settingsViewController.green,
|
||||
// blue: settingsViewController.blue,
|
||||
// alpha: opacity)
|
||||
// dismiss(animated: true)
|
||||
// }
|
@ -1,56 +0,0 @@
|
||||
//
|
||||
// TextInterface.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/9/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
enum InterfaceType: String {
|
||||
case Input
|
||||
case Output
|
||||
}
|
||||
|
||||
class TextInterface: UIView {
|
||||
|
||||
let interfaceType: InterfaceType?
|
||||
var textView: UITextView = UITextView()
|
||||
|
||||
init(interfaceType: InterfaceType) {
|
||||
self.interfaceType = interfaceType
|
||||
super.init(frame: CGRect.zero)
|
||||
setupView()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func setupView() {
|
||||
// var textView: UITextView = UITextView()
|
||||
textView = UITextView()
|
||||
textView.translatesAutoresizingMaskIntoConstraints = false
|
||||
textView.backgroundColor = UIColor(red: 0.72, green: 0.72, blue: 0.72, alpha: 1.0)
|
||||
textView.textColor = UIColor.darkGray
|
||||
textView.font = UIFont(name: "ArialMT", size: 24)
|
||||
guard let interfaceType = interfaceType else { return }
|
||||
if interfaceType == InterfaceType.Input {
|
||||
textView.isEditable = true
|
||||
} else {
|
||||
textView.isEditable = false
|
||||
}
|
||||
textView.text = "\(interfaceType)".uppercased()
|
||||
self.addSubview(textView)
|
||||
textView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||
textView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
|
||||
textView.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
|
||||
textView.trailingAnchor.constraint(equalTo: self.trailingAnchor).isActive = true
|
||||
}
|
||||
|
||||
func setText(text: String) {
|
||||
textView.text = text
|
||||
}
|
||||
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
//
|
||||
// MainPageViewController.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/9/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MainPageViewController: UIPageViewController, UIPageViewControllerDelegate, UIPageViewControllerDataSource {
|
||||
|
||||
var pageControl = UIPageControl()
|
||||
|
||||
lazy var pages: [UIViewController] = {
|
||||
var pages = [UIViewController]()
|
||||
let firstVC = CameraInterfaceViewController()
|
||||
let secondVC = TextToTextViewController()
|
||||
let thirdVC = SketchPadToImageViewController()
|
||||
pages.append(firstVC)
|
||||
pages.append(secondVC)
|
||||
pages.append(thirdVC)
|
||||
return pages
|
||||
}()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.dataSource = self
|
||||
self.delegate = self
|
||||
if let firstVC = pages.first {
|
||||
setViewControllers([firstVC], direction: .forward, animated: true, completion: nil)
|
||||
}
|
||||
configurePageControl()
|
||||
}
|
||||
|
||||
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
|
||||
guard let viewControllerIndex = pages.index(of: viewController) else { return nil }
|
||||
let previousIndex = viewControllerIndex - 1
|
||||
guard previousIndex >= 0 else { return pages.last }
|
||||
guard pages.count > previousIndex else { return nil }
|
||||
return pages[previousIndex]
|
||||
}
|
||||
|
||||
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
|
||||
guard let viewControllerIndex = pages.index(of: viewController) else { return nil }
|
||||
let nextIndex = viewControllerIndex + 1
|
||||
guard nextIndex < pages.count else { return pages.first }
|
||||
guard pages.count > nextIndex else { return nil }
|
||||
return pages[nextIndex]
|
||||
}
|
||||
|
||||
func configurePageControl() {
|
||||
pageControl = UIPageControl(frame: CGRect(x: 0,y: UIScreen.main.bounds.maxY - 50,width: UIScreen.main.bounds.width,height: 50))
|
||||
self.pageControl.numberOfPages = pages.count
|
||||
self.pageControl.currentPage = 0
|
||||
self.pageControl.alpha = 0.5
|
||||
self.pageControl.tintColor = UIColor.black
|
||||
self.pageControl.pageIndicatorTintColor = UIColor.lightGray
|
||||
self.pageControl.currentPageIndicatorTintColor = UIColor.black
|
||||
self.view.addSubview(pageControl)
|
||||
}
|
||||
|
||||
func presentationCountForPageViewController(pageViewController: UIPageViewController) -> Int {
|
||||
return pages.count
|
||||
}
|
||||
|
||||
func presentationIndexForPageViewController(pageViewController: UIPageViewController) -> Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
|
||||
let pageContentViewController = pageViewController.viewControllers![0]
|
||||
self.pageControl.currentPage = pages.index(of: pageContentViewController)!
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
//
|
||||
// MainTabBarViewController.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/9/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MainTabBarViewController: UITabBarController, UITabBarControllerDelegate {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.delegate = self
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
let firstVC = CameraInterfaceViewController()
|
||||
let firstIcon = UITabBarItem(title: "Camera", image: UIImage(named: "Photo Camera Icon"), tag: 1)
|
||||
firstVC.tabBarItem = firstIcon
|
||||
|
||||
let secondVC = TextToTextViewController()
|
||||
let secondIcon = UITabBarItem(title: "Text", image: UIImage(named: "T"), tag: 2)
|
||||
secondVC.tabBarItem = secondIcon
|
||||
|
||||
let thirdVC = SketchPadToImageViewController()
|
||||
let thirdIcon = UITabBarItem(title: "Sketch", image: UIImage(named: "Pencil"), tag: 2)
|
||||
thirdVC.tabBarItem = thirdIcon
|
||||
|
||||
let controllers = [firstVC, secondVC, thirdVC]
|
||||
self.viewControllers = controllers
|
||||
}
|
||||
|
||||
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// SketchPadToImageViewController.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/9/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SketchPadToImageViewController: UIViewController, UIGestureRecognizerDelegate {
|
||||
|
||||
var titleImageView: UIImageView = UIImageView()
|
||||
var sketchPadInput: SketchPadInterface = SketchPadInterface(interfaceType: InterfaceType.Input)
|
||||
var outputImage: UIImageView = UIImageView()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.view.backgroundColor = UIColor.white
|
||||
titleImageView.image = UIImage(named: "Title Image")
|
||||
titleImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.view.addSubview(titleImageView)
|
||||
titleImageView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 10.0).isActive = true
|
||||
titleImageView.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.5).isActive = true
|
||||
titleImageView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.08).isActive = true
|
||||
titleImageView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
|
||||
|
||||
let stackView = UIStackView()
|
||||
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.view.addSubview(stackView)
|
||||
stackView.distribution = .equalSpacing
|
||||
stackView.alignment = .fill
|
||||
stackView.axis = .vertical
|
||||
stackView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.8).isActive = true
|
||||
stackView.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.8).isActive = true
|
||||
stackView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
|
||||
stackView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor).isActive = true
|
||||
|
||||
sketchPadInput.translatesAutoresizingMaskIntoConstraints = false
|
||||
sketchPadInput.backgroundColor = UIColor(red: 0.72, green: 0.72, blue: 0.72, alpha: 1.0)
|
||||
stackView.addArrangedSubview(sketchPadInput)
|
||||
sketchPadInput.heightAnchor.constraint(equalTo: stackView.heightAnchor, multiplier: 0.45).isActive = true
|
||||
sketchPadInput.widthAnchor.constraint(equalTo: stackView.widthAnchor).isActive = true
|
||||
|
||||
outputImage.translatesAutoresizingMaskIntoConstraints = false
|
||||
outputImage.backgroundColor = UIColor(red: 0.72, green: 0.72, blue: 0.72, alpha: 1.0)
|
||||
stackView.addArrangedSubview(outputImage)
|
||||
outputImage.heightAnchor.constraint(equalTo: stackView.heightAnchor, multiplier: 0.45).isActive = true
|
||||
outputImage.widthAnchor.constraint(equalTo: stackView.widthAnchor).isActive = true
|
||||
|
||||
// let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
// cameraViewController = storyBoard.instantiateViewController(withIdentifier: "CameraViewController") as? CameraViewController
|
||||
//
|
||||
// let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(imageTapped(tapGestureRecognizer:)))
|
||||
// preview.isUserInteractionEnabled = true
|
||||
// preview.addGestureRecognizer(tapGestureRecognizer)
|
||||
//
|
||||
// updatePreviewWithCapturedImage()
|
||||
// setupWebSocket()
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
//
|
||||
// TextToTextViewController.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/9/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Starscream
|
||||
|
||||
class TextToTextViewController: UIViewController, WebSocketDelegate {
|
||||
|
||||
var titleImageView: UIImageView = UIImageView()
|
||||
var inputTextView: TextInterface = TextInterface(interfaceType: InterfaceType.Input)
|
||||
var outputTextView: TextInterface = TextInterface(interfaceType: InterfaceType.Output)
|
||||
var socket: WebSocket = WebSocket(url: URL(string: "ws://c3f3ea66.ngrok.io")!)
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.view.backgroundColor = UIColor.white
|
||||
|
||||
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
|
||||
self.view.addGestureRecognizer(tap)
|
||||
|
||||
titleImageView.image = UIImage(named: "Title Image")
|
||||
titleImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.view.addSubview(titleImageView)
|
||||
titleImageView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 10.0).isActive = true
|
||||
titleImageView.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.5).isActive = true
|
||||
titleImageView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.08).isActive = true
|
||||
titleImageView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
|
||||
|
||||
let stackView = UIStackView()
|
||||
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.view.addSubview(stackView)
|
||||
stackView.distribution = .equalSpacing
|
||||
stackView.alignment = .fill
|
||||
stackView.axis = .vertical
|
||||
stackView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.8).isActive = true
|
||||
stackView.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.8).isActive = true
|
||||
stackView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
|
||||
stackView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor).isActive = true
|
||||
|
||||
inputTextView.translatesAutoresizingMaskIntoConstraints = false
|
||||
inputTextView.backgroundColor = UIColor(red: 0.72, green: 0.72, blue: 0.72, alpha: 1.0)
|
||||
stackView.addArrangedSubview(inputTextView)
|
||||
inputTextView.heightAnchor.constraint(equalTo: stackView.heightAnchor, multiplier: 0.45).isActive = true
|
||||
inputTextView.widthAnchor.constraint(equalTo: stackView.widthAnchor).isActive = true
|
||||
|
||||
outputTextView.translatesAutoresizingMaskIntoConstraints = false
|
||||
outputTextView.backgroundColor = UIColor(red: 0.72, green: 0.72, blue: 0.72, alpha: 1.0)
|
||||
stackView.addArrangedSubview(outputTextView)
|
||||
outputTextView.heightAnchor.constraint(equalTo: stackView.heightAnchor, multiplier: 0.45).isActive = true
|
||||
outputTextView.widthAnchor.constraint(equalTo: stackView.widthAnchor).isActive = true
|
||||
|
||||
// let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
// cameraViewController = storyBoard.instantiateViewController(withIdentifier: "CameraViewController") as? CameraViewController
|
||||
//
|
||||
// let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(imageTapped(tapGestureRecognizer:)))
|
||||
// preview.isUserInteractionEnabled = true
|
||||
// preview.addGestureRecognizer(tapGestureRecognizer)
|
||||
//
|
||||
// updatePreviewWithCapturedImage()
|
||||
setupWebSocket()
|
||||
}
|
||||
|
||||
@objc func dismissKeyboard() {
|
||||
view.endEditing(true)
|
||||
}
|
||||
|
||||
func setupWebSocket() {
|
||||
socket.delegate = self
|
||||
socket.connect()
|
||||
}
|
||||
|
||||
func websocketDidConnect(socket: WebSocketClient) {
|
||||
print("Web Socket Connected!")
|
||||
}
|
||||
|
||||
func websocketDidDisconnect(socket: WebSocketClient, error: Error?) {
|
||||
print("Web Socket Disconnected: ", error.debugDescription)
|
||||
}
|
||||
|
||||
func websocketDidReceiveMessage(socket: WebSocketClient, text: String) {
|
||||
print("Web Socket received message!")
|
||||
outputTextView.setText(text: text)
|
||||
}
|
||||
|
||||
func websocketDidReceiveData(socket: WebSocketClient, data: Data) {
|
||||
print("Web Socket received data!")
|
||||
outputTextView.setText(text: data.base64EncodedString())
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
//
|
||||
// UIImage+Extensions.swift
|
||||
// Gradio
|
||||
//
|
||||
// Created by Dawood Khan on 3/7/19.
|
||||
// Copyright © 2019 Gradio. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIImage {
|
||||
// func resizeImage(_ dimension: CGFloat, opaque: Bool, contentMode: UIView.ContentMode = .scaleAspectFit) -> UIImage {
|
||||
// var width: CGFloat
|
||||
// var height: CGFloat
|
||||
// var newImage: UIImage
|
||||
//
|
||||
// let size = self.size
|
||||
// let aspectRatio = size.width/size.height
|
||||
//
|
||||
// switch contentMode {
|
||||
// case .scaleAspectFit:
|
||||
// if aspectRatio > 1 { // Landscape image
|
||||
// width = dimension
|
||||
// height = dimension / aspectRatio
|
||||
// } else { // Portrait image
|
||||
// height = dimension
|
||||
// width = dimension * aspectRatio
|
||||
// }
|
||||
//
|
||||
// default:
|
||||
// fatalError("UIIMage.resizeToFit(): FATAL: Unimplemented ContentMode")
|
||||
// }
|
||||
//
|
||||
// if #available(iOS 10.0, *) {
|
||||
// let renderFormat = UIGraphicsImageRendererFormat.default()
|
||||
// renderFormat.opaque = opaque
|
||||
// let renderer = UIGraphicsImageRenderer(size: CGSize(width: width, height: height), format: renderFormat)
|
||||
// newImage = renderer.image {
|
||||
// (context) in
|
||||
// self.draw(in: CGRect(x: 0, y: 0, width: width, height: height))
|
||||
// }
|
||||
// } else {
|
||||
// UIGraphicsBeginImageContextWithOptions(CGSize(width: width, height: height), opaque, 0)
|
||||
// self.draw(in: CGRect(x: 0, y: 0, width: width, height: height))
|
||||
// newImage = UIGraphicsGetImageFromCurrentImageContext()!
|
||||
// UIGraphicsEndImageContext()
|
||||
// }
|
||||
//
|
||||
// return newImage
|
||||
// }
|
||||
|
||||
func resizeImage(targetSize: CGSize) -> UIImage {
|
||||
let size = self.size
|
||||
|
||||
let widthRatio = targetSize.width / size.width
|
||||
let heightRatio = targetSize.height / size.height
|
||||
|
||||
// Figure out what our orientation is, and use that to form the rectangle
|
||||
var newSize: CGSize
|
||||
if(widthRatio > heightRatio) {
|
||||
newSize = CGSize(width: size.width * heightRatio, height: size.height * heightRatio)
|
||||
} else {
|
||||
newSize = CGSize(width: size.width * widthRatio, height: size.height * widthRatio)
|
||||
}
|
||||
|
||||
// This is the rect that we've calculated out and this is what is actually used below
|
||||
let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)
|
||||
|
||||
// Actually do the resizing to the rect using the ImageContext stuff
|
||||
UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0)
|
||||
self.draw(in: rect)
|
||||
let newImage = UIGraphicsGetImageFromCurrentImageContext()
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
return newImage!
|
||||
}
|
||||
}
|
11
iOS/Podfile
@ -1,11 +0,0 @@
|
||||
# Uncomment the next line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
target 'Gradio' do
|
||||
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
|
||||
use_frameworks!
|
||||
|
||||
# Pods for Gradio
|
||||
pod 'Starscream', '~> 3.0.2'
|
||||
|
||||
end
|
@ -1,16 +0,0 @@
|
||||
PODS:
|
||||
- Starscream (3.0.6)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Starscream (~> 3.0.2)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
- Starscream
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Starscream: ef3ece99d765eeccb67de105bfa143f929026cf5
|
||||
|
||||
PODFILE CHECKSUM: 2f2c34c8ff3ab88ffa46fb47cbe80129af8b19a3
|
||||
|
||||
COCOAPODS: 1.5.3
|