[swift 4] improve test suite (#4561)

* [swift] improve testing in sample projects

* [swift] update run tests script

* [swift] regenerate samples

* [swift] fix tests with PromiseKit

* [swift4] compile every project with swift package manager
This commit is contained in:
Bruno Coelho
2019-11-21 14:40:49 +00:00
committed by William Cheng
parent f434b5fa13
commit 51aeb6c833
430 changed files with 2876 additions and 5146 deletions

View File

@@ -0,0 +1,72 @@
### https://raw.github.com/github/gitignore/7792e50daeaa6c07460484704671d1dc9f0045a7/Swift.gitignore
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
.build/
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

View File

@@ -0,0 +1,13 @@
platform :ios, '9.0'
source 'https://cdn.cocoapods.org/'
use_frameworks!
target 'SwaggerClient' do
pod "PetstoreClient", :path => "../"
target 'SwaggerClientTests' do
inherit! :search_paths
end
end

View File

@@ -0,0 +1,27 @@
PODS:
- Alamofire (4.9.0)
- PetstoreClient (1.0.0):
- Alamofire (~> 4.9.0)
- RxSwift (~> 4.5.0)
- RxSwift (4.5.0)
DEPENDENCIES:
- PetstoreClient (from `../`)
SPEC REPOS:
trunk:
- Alamofire
- RxSwift
EXTERNAL SOURCES:
PetstoreClient:
:path: "../"
SPEC CHECKSUMS:
Alamofire: afc3e7c6db61476cb45cdd23fed06bad03bbc321
PetstoreClient: c8065402040b3f3604ff959e729637f863227d27
RxSwift: f172070dfd1a93d70a9ab97a5a01166206e1c575
PODFILE CHECKSUM: 509bec696cc1d8641751b52e4fe4bef04ac4542c
COCOAPODS: 1.8.4

View File

@@ -0,0 +1,543 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
B024164FBFF71BF644D4419A /* Pods_SwaggerClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 177A58DD5CF63F2989335DCC /* Pods_SwaggerClient.framework */; };
B1D0246C8960F47A60098F37 /* Pods_SwaggerClientTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F96A0131101344CC5406CB3 /* Pods_SwaggerClientTests.framework */; };
B596E4BD205657A500B46F03 /* APIHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B596E4BC205657A500B46F03 /* APIHelperTests.swift */; };
EAEC0BC21D4E30CE00C908A3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAEC0BC11D4E30CE00C908A3 /* AppDelegate.swift */; };
EAEC0BC41D4E30CE00C908A3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAEC0BC31D4E30CE00C908A3 /* ViewController.swift */; };
EAEC0BC71D4E30CE00C908A3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EAEC0BC51D4E30CE00C908A3 /* Main.storyboard */; };
EAEC0BC91D4E30CE00C908A3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EAEC0BC81D4E30CE00C908A3 /* Assets.xcassets */; };
EAEC0BCC1D4E30CE00C908A3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EAEC0BCA1D4E30CE00C908A3 /* LaunchScreen.storyboard */; };
EAEC0BE41D4E330700C908A3 /* PetAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAEC0BE31D4E330700C908A3 /* PetAPITests.swift */; };
EAEC0BE61D4E379000C908A3 /* StoreAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAEC0BE51D4E379000C908A3 /* StoreAPITests.swift */; };
EAEC0BE81D4E38CB00C908A3 /* UserAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAEC0BE71D4E38CB00C908A3 /* UserAPITests.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
EAEC0BD31D4E30CE00C908A3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = EAEC0BB61D4E30CE00C908A3 /* Project object */;
proxyType = 1;
remoteGlobalIDString = EAEC0BBD1D4E30CE00C908A3;
remoteInfo = SwaggerClient;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
177A58DD5CF63F2989335DCC /* Pods_SwaggerClient.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwaggerClient.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2DEFA8828BD4E38FA5262F53 /* Pods-SwaggerClient.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient/Pods-SwaggerClient.release.xcconfig"; sourceTree = "<group>"; };
4EF2021609D112A6F5AE0F55 /* Pods-SwaggerClientTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClientTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClientTests/Pods-SwaggerClientTests.debug.xcconfig"; sourceTree = "<group>"; };
6F96A0131101344CC5406CB3 /* Pods_SwaggerClientTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwaggerClientTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8D99518E8E05FD856A952698 /* Pods-SwaggerClient.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient/Pods-SwaggerClient.debug.xcconfig"; sourceTree = "<group>"; };
B596E4BC205657A500B46F03 /* APIHelperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIHelperTests.swift; sourceTree = "<group>"; };
EAEC0BBE1D4E30CE00C908A3 /* SwaggerClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwaggerClient.app; sourceTree = BUILT_PRODUCTS_DIR; };
EAEC0BC11D4E30CE00C908A3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
EAEC0BC31D4E30CE00C908A3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
EAEC0BC61D4E30CE00C908A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
EAEC0BC81D4E30CE00C908A3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
EAEC0BCB1D4E30CE00C908A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
EAEC0BCD1D4E30CE00C908A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
EAEC0BD21D4E30CE00C908A3 /* SwaggerClientTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwaggerClientTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
EAEC0BD81D4E30CE00C908A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
EAEC0BE31D4E330700C908A3 /* PetAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetAPITests.swift; sourceTree = "<group>"; };
EAEC0BE51D4E379000C908A3 /* StoreAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreAPITests.swift; sourceTree = "<group>"; };
EAEC0BE71D4E38CB00C908A3 /* UserAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserAPITests.swift; sourceTree = "<group>"; };
EFD8AB05F53C74985527D117 /* Pods-SwaggerClientTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClientTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClientTests/Pods-SwaggerClientTests.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
EAEC0BBB1D4E30CE00C908A3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B024164FBFF71BF644D4419A /* Pods_SwaggerClient.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
EAEC0BCF1D4E30CE00C908A3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B1D0246C8960F47A60098F37 /* Pods_SwaggerClientTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
55DC454FF5FFEF8A9CBC1CA3 /* Frameworks */ = {
isa = PBXGroup;
children = (
177A58DD5CF63F2989335DCC /* Pods_SwaggerClient.framework */,
6F96A0131101344CC5406CB3 /* Pods_SwaggerClientTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
CB19142D951AB5DD885404A8 /* Pods */ = {
isa = PBXGroup;
children = (
8D99518E8E05FD856A952698 /* Pods-SwaggerClient.debug.xcconfig */,
2DEFA8828BD4E38FA5262F53 /* Pods-SwaggerClient.release.xcconfig */,
4EF2021609D112A6F5AE0F55 /* Pods-SwaggerClientTests.debug.xcconfig */,
EFD8AB05F53C74985527D117 /* Pods-SwaggerClientTests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
EAEC0BB51D4E30CE00C908A3 = {
isa = PBXGroup;
children = (
EAEC0BC01D4E30CE00C908A3 /* SwaggerClient */,
EAEC0BD51D4E30CE00C908A3 /* SwaggerClientTests */,
EAEC0BBF1D4E30CE00C908A3 /* Products */,
CB19142D951AB5DD885404A8 /* Pods */,
55DC454FF5FFEF8A9CBC1CA3 /* Frameworks */,
);
sourceTree = "<group>";
};
EAEC0BBF1D4E30CE00C908A3 /* Products */ = {
isa = PBXGroup;
children = (
EAEC0BBE1D4E30CE00C908A3 /* SwaggerClient.app */,
EAEC0BD21D4E30CE00C908A3 /* SwaggerClientTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
EAEC0BC01D4E30CE00C908A3 /* SwaggerClient */ = {
isa = PBXGroup;
children = (
EAEC0BC11D4E30CE00C908A3 /* AppDelegate.swift */,
EAEC0BC31D4E30CE00C908A3 /* ViewController.swift */,
EAEC0BC51D4E30CE00C908A3 /* Main.storyboard */,
EAEC0BC81D4E30CE00C908A3 /* Assets.xcassets */,
EAEC0BCA1D4E30CE00C908A3 /* LaunchScreen.storyboard */,
EAEC0BCD1D4E30CE00C908A3 /* Info.plist */,
);
path = SwaggerClient;
sourceTree = "<group>";
};
EAEC0BD51D4E30CE00C908A3 /* SwaggerClientTests */ = {
isa = PBXGroup;
children = (
EAEC0BD81D4E30CE00C908A3 /* Info.plist */,
EAEC0BE31D4E330700C908A3 /* PetAPITests.swift */,
EAEC0BE51D4E379000C908A3 /* StoreAPITests.swift */,
EAEC0BE71D4E38CB00C908A3 /* UserAPITests.swift */,
B596E4BC205657A500B46F03 /* APIHelperTests.swift */,
);
path = SwaggerClientTests;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
EAEC0BBD1D4E30CE00C908A3 /* SwaggerClient */ = {
isa = PBXNativeTarget;
buildConfigurationList = EAEC0BDB1D4E30CE00C908A3 /* Build configuration list for PBXNativeTarget "SwaggerClient" */;
buildPhases = (
898E536ECC2C4811DDDF67C1 /* [CP] Check Pods Manifest.lock */,
EAEC0BBA1D4E30CE00C908A3 /* Sources */,
EAEC0BBB1D4E30CE00C908A3 /* Frameworks */,
EAEC0BBC1D4E30CE00C908A3 /* Resources */,
8A7961360961F06AADAF17C9 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = SwaggerClient;
productName = SwaggerClient;
productReference = EAEC0BBE1D4E30CE00C908A3 /* SwaggerClient.app */;
productType = "com.apple.product-type.application";
};
EAEC0BD11D4E30CE00C908A3 /* SwaggerClientTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = EAEC0BDE1D4E30CE00C908A3 /* Build configuration list for PBXNativeTarget "SwaggerClientTests" */;
buildPhases = (
82CB35D52E274C6177DAC0DD /* [CP] Check Pods Manifest.lock */,
EAEC0BCE1D4E30CE00C908A3 /* Sources */,
EAEC0BCF1D4E30CE00C908A3 /* Frameworks */,
EAEC0BD01D4E30CE00C908A3 /* Resources */,
);
buildRules = (
);
dependencies = (
EAEC0BD41D4E30CE00C908A3 /* PBXTargetDependency */,
);
name = SwaggerClientTests;
productName = SwaggerClientTests;
productReference = EAEC0BD21D4E30CE00C908A3 /* SwaggerClientTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
EAEC0BB61D4E30CE00C908A3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = Swagger;
TargetAttributes = {
EAEC0BBD1D4E30CE00C908A3 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
};
EAEC0BD11D4E30CE00C908A3 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
TestTargetID = EAEC0BBD1D4E30CE00C908A3;
};
};
};
buildConfigurationList = EAEC0BB91D4E30CE00C908A3 /* Build configuration list for PBXProject "SwaggerClient" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = EAEC0BB51D4E30CE00C908A3;
productRefGroup = EAEC0BBF1D4E30CE00C908A3 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
EAEC0BBD1D4E30CE00C908A3 /* SwaggerClient */,
EAEC0BD11D4E30CE00C908A3 /* SwaggerClientTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
EAEC0BBC1D4E30CE00C908A3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EAEC0BCC1D4E30CE00C908A3 /* LaunchScreen.storyboard in Resources */,
EAEC0BC91D4E30CE00C908A3 /* Assets.xcassets in Resources */,
EAEC0BC71D4E30CE00C908A3 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
EAEC0BD01D4E30CE00C908A3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
82CB35D52E274C6177DAC0DD /* [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-SwaggerClientTests-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;
};
898E536ECC2C4811DDDF67C1 /* [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-SwaggerClient-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;
};
8A7961360961F06AADAF17C9 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-SwaggerClient/Pods-SwaggerClient-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/PetstoreClient/PetstoreClient.framework",
"${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PetstoreClient.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SwaggerClient/Pods-SwaggerClient-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
EAEC0BBA1D4E30CE00C908A3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EAEC0BC41D4E30CE00C908A3 /* ViewController.swift in Sources */,
EAEC0BC21D4E30CE00C908A3 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
EAEC0BCE1D4E30CE00C908A3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B596E4BD205657A500B46F03 /* APIHelperTests.swift in Sources */,
EAEC0BE81D4E38CB00C908A3 /* UserAPITests.swift in Sources */,
EAEC0BE61D4E379000C908A3 /* StoreAPITests.swift in Sources */,
EAEC0BE41D4E330700C908A3 /* PetAPITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
EAEC0BD41D4E30CE00C908A3 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EAEC0BBD1D4E30CE00C908A3 /* SwaggerClient */;
targetProxy = EAEC0BD31D4E30CE00C908A3 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
EAEC0BC51D4E30CE00C908A3 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
EAEC0BC61D4E30CE00C908A3 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
EAEC0BCA1D4E30CE00C908A3 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
EAEC0BCB1D4E30CE00C908A3 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
EAEC0BD91D4E30CE00C908A3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
EAEC0BDA1D4E30CE00C908A3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
EAEC0BDC1D4E30CE00C908A3 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8D99518E8E05FD856A952698 /* Pods-SwaggerClient.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = SwaggerClient/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.swagger.SwaggerClient;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
EAEC0BDD1D4E30CE00C908A3 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 2DEFA8828BD4E38FA5262F53 /* Pods-SwaggerClient.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = SwaggerClient/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.swagger.SwaggerClient;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
EAEC0BDF1D4E30CE00C908A3 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 4EF2021609D112A6F5AE0F55 /* Pods-SwaggerClientTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
INFOPLIST_FILE = SwaggerClientTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.swagger.SwaggerClientTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwaggerClient.app/SwaggerClient";
};
name = Debug;
};
EAEC0BE01D4E30CE00C908A3 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = EFD8AB05F53C74985527D117 /* Pods-SwaggerClientTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
INFOPLIST_FILE = SwaggerClientTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.swagger.SwaggerClientTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwaggerClient.app/SwaggerClient";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
EAEC0BB91D4E30CE00C908A3 /* Build configuration list for PBXProject "SwaggerClient" */ = {
isa = XCConfigurationList;
buildConfigurations = (
EAEC0BD91D4E30CE00C908A3 /* Debug */,
EAEC0BDA1D4E30CE00C908A3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EAEC0BDB1D4E30CE00C908A3 /* Build configuration list for PBXNativeTarget "SwaggerClient" */ = {
isa = XCConfigurationList;
buildConfigurations = (
EAEC0BDC1D4E30CE00C908A3 /* Debug */,
EAEC0BDD1D4E30CE00C908A3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EAEC0BDE1D4E30CE00C908A3 /* Build configuration list for PBXNativeTarget "SwaggerClientTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
EAEC0BDF1D4E30CE00C908A3 /* Debug */,
EAEC0BE01D4E30CE00C908A3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = EAEC0BB61D4E30CE00C908A3 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:SwaggerClient.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EAEC0BBD1D4E30CE00C908A3"
BuildableName = "SwaggerClient.app"
BlueprintName = "SwaggerClient"
ReferencedContainer = "container:SwaggerClient.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EAEC0BD11D4E30CE00C908A3"
BuildableName = "SwaggerClientTests.xctest"
BlueprintName = "SwaggerClientTests"
ReferencedContainer = "container:SwaggerClient.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EAEC0BBD1D4E30CE00C908A3"
BuildableName = "SwaggerClient.app"
BlueprintName = "SwaggerClient"
ReferencedContainer = "container:SwaggerClient.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EAEC0BBD1D4E30CE00C908A3"
BuildableName = "SwaggerClient.app"
BlueprintName = "SwaggerClient"
ReferencedContainer = "container:SwaggerClient.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EAEC0BBD1D4E30CE00C908A3"
BuildableName = "SwaggerClient.app"
BlueprintName = "SwaggerClient"
ReferencedContainer = "container:SwaggerClient.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:SwaggerClient.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,43 @@
//
// AppDelegate.swift
// SwaggerClient
//
// Created by Tony Wang on 7/31/16.
// Copyright © 2016 Swagger. 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

View File

@@ -0,0 +1,48 @@
{
"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"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

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="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>petstore.swagger.io</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,23 @@
//
// ViewController.swift
// SwaggerClient
//
// Created by Tony Wang on 7/31/16.
// Copyright © 2016 Swagger. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

View File

@@ -0,0 +1,55 @@
//
// APIHelperTests.swift
// SwaggerClientTests
//
// Created by Daiki Matsudate on 2018/03/12.
// Copyright © 2018 Swagger. All rights reserved.
//
import XCTest
import PetstoreClient
@testable import SwaggerClient
class APIHelperTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testRejectNil() {
let source: [String: Any?] = ["a": 1, "b": nil, "c": ["1", nil, "2"], "d": true, "e": false]
let expected: [String: Any] = ["a": 1, "c": ["1", nil, "2"], "d": true, "e": false]
let actual: [String: Any] = APIHelper.rejectNil(source)!
XCTAssert(NSDictionary(dictionary: actual).isEqual(to: expected))
}
func testRejectNilHeaders() {
let source: [String: Any?] = ["a": 1, "b": nil, "c": ["1", nil, "2"], "d": true, "e": false]
let expected: [String: String] = ["a": "1", "c": "1,2", "d": "true", "e": "false"]
let actual: [String: String] = APIHelper.rejectNilHeaders(source)
XCTAssert(NSDictionary(dictionary: actual).isEqual(to: expected))
}
func testConvertBoolToString() {
let source: [String: Any] = ["a": 1, "c": ["1", nil, "2"], "d": true, "e": false]
let expected: [String: Any] = ["a": 1, "c": ["1", nil, "2"], "d": "true", "e": "false"]
let actual: [String: Any] = APIHelper.convertBoolToString(source)!
XCTAssert(NSDictionary(dictionary: actual).isEqual(to: expected))
}
func testMapValuesToQueryItems() {
let source: [String: Any] = ["a": 1, "c": ["1", nil, "2"], "d": true, "e": false]
let expected: [URLQueryItem] = [URLQueryItem(name: "a", value: "1"),
URLQueryItem(name: "c", value: "1,2"),
URLQueryItem(name: "d", value: "true"),
URLQueryItem(name: "e", value: "false")].sorted(by: { $0.name > $1.name })
let actual: [URLQueryItem] = APIHelper.mapValuesToQueryItems(source)!.sorted(by: { $0.name > $1.name })
XCTAssert(actual == expected)
}
}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>petstore.swagger.io</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,88 @@
//
// PetAPITests.swift
// SwaggerClient
//
// Created by Tony Wang on 7/31/16.
// Copyright © 2016 Swagger. All rights reserved.
//
import PetstoreClient
import RxSwift
import XCTest
@testable import SwaggerClient
class PetAPITests: XCTestCase {
let testTimeout = 10.0
let disposeBag = DisposeBag()
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func test1CreatePet() {
let expectation = self.expectation(description: "testCreatePet")
let category = PetstoreClient.Category(id: 1234, name: "eyeColor")
let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")]
let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available)
PetAPI.addPet(body: newPet).subscribe(onNext: {
expectation.fulfill()
}, onError: { _ in
XCTFail("error creating pet")
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func test2GetPet() {
let expectation = self.expectation(description: "testGetPet")
PetAPI.getPetById(petId: 1000).subscribe(onNext: { pet in
XCTAssert(pet.id == 1000, "invalid id")
XCTAssert(pet.name == "Fluffy", "invalid name")
XCTAssert(pet.category!.id == 1234, "invalid category id")
XCTAssert(pet.category!.name == "eyeColor", "invalid category name")
let tag1 = pet.tags![0]
XCTAssert(tag1.id == 1234, "invalid tag id")
XCTAssert(tag1.name == "New York", "invalid tag name")
let tag2 = pet.tags![1]
XCTAssert(tag2.id == 124321, "invalid tag id")
XCTAssert(tag2.name == "Jose", "invalid tag name")
XCTAssert(pet.photoUrls[0] == "https://petstore.com/sample/photo1.jpg")
XCTAssert(pet.photoUrls[1] == "https://petstore.com/sample/photo2.jpg")
expectation.fulfill()
}, onError: { _ in
XCTFail("error getting pet")
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func test3DeletePet() {
let expectation = self.expectation(description: "testDeletePet")
PetAPI.deletePet(petId: 1000).subscribe(onNext: {
expectation.fulfill()
}, onError: { errorType in
// The server gives us no data back so alamofire parsing fails - at least
// verify that is the error we get here
// Error Domain=com.alamofire.error Code=-6006 "JSON could not be serialized. Input data was nil or zero
// length." UserInfo={NSLocalizedFailureReason=JSON could not be serialized. Input data was nil or zero
// length.}
let error = errorType as NSError
if error.code == -6006 {
expectation.fulfill()
} else {
XCTFail("error deleting pet")
}
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
}

View File

@@ -0,0 +1,93 @@
//
// StoreAPITests.swift
// SwaggerClient
//
// Created by Tony Wang on 7/31/16.
// Copyright © 2016 Swagger. All rights reserved.
//
import PetstoreClient
import RxSwift
import XCTest
@testable import SwaggerClient
class StoreAPITests: XCTestCase {
let isoDateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
let testTimeout = 10.0
let disposeBag = DisposeBag()
func test1PlaceOrder() {
// use explicit naming to reference the enum so that we test we don't regress on enum naming
let shipDate = Date()
let order = Order(id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true)
let expectation = self.expectation(description: "testPlaceOrder")
StoreAPI.placeOrder(body: order).subscribe(onNext: { order in
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
XCTAssert(order.shipDate!.isEqual(shipDate, format: self.isoDateFormat),
"Date should be idempotent")
XCTAssert(order.complete == true, "invalid complete")
expectation.fulfill()
}, onError: { _ in
XCTFail("error placing order")
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func test2GetOrder() {
let expectation = self.expectation(description: "testGetOrder")
StoreAPI.getOrderById(orderId: 1000).subscribe(onNext: { order -> Void in
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
XCTAssert(order.complete == true, "invalid complete")
expectation.fulfill()
}, onError: { _ in
XCTFail("error placing order")
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func test3DeleteOrder() {
let expectation = self.expectation(description: "testDeleteOrder")
StoreAPI.deleteOrder(orderId: "1000").subscribe(onNext: {
expectation.fulfill()
}, onError: { errorType -> Void in
// The server gives us no data back so alamofire parsing fails - at least
// verify that is the error we get here
// Error Domain=com.alamofire.error Code=-6006 "JSON could not be serialized. Input data was nil or zero
// length." UserInfo={NSLocalizedFailureReason=JSON could not be serialized. Input data was nil or zero
// length.}
let error = errorType as NSError
if error.code == -6006 {
expectation.fulfill()
} else {
XCTFail("error deleting order")
}
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
}
private extension Date {
/**
Returns true if the dates are equal given the format string.
- parameter date: The date to compare to.
- parameter format: The format string to use to compare.
- returns: true if the dates are equal, given the format string.
*/
func isEqual(_ date: Date, format: String) -> Bool {
let fmt = DateFormatter()
fmt.dateFormat = format
return fmt.string(from: self).isEqual(fmt.string(from: date))
}
}

View File

@@ -0,0 +1,125 @@
//
// UserAPITests.swift
// SwaggerClient
//
// Created by Tony Wang on 7/31/16.
// Copyright © 2016 Swagger. All rights reserved.
//
import PetstoreClient
import RxSwift
import XCTest
@testable import SwaggerClient
class UserAPITests: XCTestCase {
let testTimeout = 10.0
let disposeBag = DisposeBag()
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testLogin() {
let expectation = self.expectation(description: "testLogin")
UserAPI.loginUser(username: "swiftTester", password: "swift").subscribe(onNext: { _ in
expectation.fulfill()
}, onError: { errorType in
// The server isn't returning JSON - and currently the alamofire implementation
// always parses responses as JSON, so making an exception for this here
// Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0."
// UserInfo={NSDebugDescription=Invalid value around character 0.}
let error = errorType as NSError
if error.code == 3840 {
expectation.fulfill()
} else {
XCTFail("error logging in")
}
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func testLogout() {
let expectation = self.expectation(description: "testLogout")
UserAPI.logoutUser().subscribe(onNext: {
expectation.fulfill()
}, onError: { errorType in
// The server gives us no data back so alamofire parsing fails - at least
// verify that is the error we get here
// Error Domain=com.alamofire.error Code=-6006 "JSON could not be serialized. Input data was nil or zero
// length." UserInfo={NSLocalizedFailureReason=JSON could not be serialized. Input data was nil or zero
// length.}
let error = errorType as NSError
if error.code == -6006 {
expectation.fulfill()
} else {
XCTFail("error logging out")
}
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func test1CreateUser() {
let expectation = self.expectation(description: "testCreateUser")
let newUser = User(id: 1000, username: "test@test.com", firstName: "Test", lastName: "Tester", email: "test@test.com", password: "test!", phone: "867-5309", userStatus: 0)
UserAPI.createUser(body: newUser).subscribe(onNext: {
expectation.fulfill()
}, onError: { errorType in
// The server gives us no data back so alamofire parsing fails - at least
// verify that is the error we get here
// Error Domain=com.alamofire.error Code=-6006 "JSON could not be serialized. Input data was nil or zero
// length." UserInfo={NSLocalizedFailureReason=JSON could not be serialized. Input data was nil or zero
// length.}
let error = errorType as NSError
if error.code == -6006 {
expectation.fulfill()
} else {
XCTFail("error creating user")
}
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func test2GetUser() {
let expectation = self.expectation(description: "testGetUser")
UserAPI.getUserByName(username: "test@test.com").subscribe(onNext: {user -> Void in
XCTAssert(user.userStatus == 0, "invalid userStatus")
XCTAssert(user.email == "test@test.com", "invalid email")
XCTAssert(user.firstName == "Test", "invalid firstName")
XCTAssert(user.lastName == "Tester", "invalid lastName")
XCTAssert(user.password == "test!", "invalid password")
XCTAssert(user.phone == "867-5309", "invalid phone")
expectation.fulfill()
}, onError: { _ in
XCTFail("error getting user")
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
func test3DeleteUser() {
let expectation = self.expectation(description: "testDeleteUser")
UserAPI.deleteUser(username: "test@test.com").subscribe(onNext: {
expectation.fulfill()
}, onError: { errorType -> Void in
// The server gives us no data back so alamofire parsing fails - at least
// verify that is the error we get here
// Error Domain=com.alamofire.error Code=-6006 "JSON could not be serialized. Input data was nil or zero
// length." UserInfo={NSLocalizedFailureReason=JSON could not be serialized. Input data was nil or zero
// length.}
let error = errorType as NSError
if error.code == -6006 {
expectation.fulfill()
} else {
XCTFail("error deleting user")
}
}).disposed(by: disposeBag)
self.waitForExpectations(timeout: testTimeout, handler: nil)
}
}

View File

@@ -0,0 +1,43 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>Swift4RxSwiftPetstoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Swift4 RxSwift Swagger Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>xcodebuild-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./run_xcodebuild.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,5 @@
#!/bin/sh
pod install
xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]}