Compare commits
No commits in common. "cc0f28eb6998f27892d885e8caef8240dfe23b05" and "09bd1740de9e98014adb5f9a896527ad52459517" have entirely different histories.
cc0f28eb69
...
09bd1740de
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,8 +0,0 @@
|
||||
# ---> Xcode
|
||||
## User settings
|
||||
xcuserdata/
|
||||
|
||||
## Xcode 8 and earlier
|
||||
*.xcscmblueprint
|
||||
*.xccheckout
|
||||
|
||||
578
EmployeeDirectory.xcodeproj/project.pbxproj
Normal file
578
EmployeeDirectory.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,578 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
EAC304B92D76693000D9006D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = EAC304A02D76692F00D9006D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EAC304A72D76692F00D9006D;
|
||||
remoteInfo = EmployeeDirectory;
|
||||
};
|
||||
EAC304C32D76693000D9006D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = EAC304A02D76692F00D9006D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EAC304A72D76692F00D9006D;
|
||||
remoteInfo = EmployeeDirectory;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
EAC304A82D76692F00D9006D /* EmployeeDirectory.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EmployeeDirectory.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EAC304B82D76693000D9006D /* EmployeeDirectoryTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EmployeeDirectoryTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EAC304C22D76693000D9006D /* EmployeeDirectoryUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EmployeeDirectoryUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
EA57F4B72D778F140015D7BC /* Exceptions for "EmployeeDirectory" folder in "EmployeeDirectory" target */ = {
|
||||
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||
membershipExceptions = (
|
||||
Info.plist,
|
||||
);
|
||||
target = EAC304A72D76692F00D9006D /* EmployeeDirectory */;
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
EAC304AA2D76692F00D9006D /* EmployeeDirectory */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
exceptions = (
|
||||
EA57F4B72D778F140015D7BC /* Exceptions for "EmployeeDirectory" folder in "EmployeeDirectory" target */,
|
||||
);
|
||||
path = EmployeeDirectory;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EAC304BB2D76693000D9006D /* EmployeeDirectoryTests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = EmployeeDirectoryTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EAC304C52D76693000D9006D /* EmployeeDirectoryUITests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = EmployeeDirectoryUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
EAC304A52D76692F00D9006D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EAC304B52D76693000D9006D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EAC304BF2D76693000D9006D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
EAC3049F2D76692F00D9006D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EAC304AA2D76692F00D9006D /* EmployeeDirectory */,
|
||||
EAC304BB2D76693000D9006D /* EmployeeDirectoryTests */,
|
||||
EAC304C52D76693000D9006D /* EmployeeDirectoryUITests */,
|
||||
EAC304A92D76692F00D9006D /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EAC304A92D76692F00D9006D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EAC304A82D76692F00D9006D /* EmployeeDirectory.app */,
|
||||
EAC304B82D76693000D9006D /* EmployeeDirectoryTests.xctest */,
|
||||
EAC304C22D76693000D9006D /* EmployeeDirectoryUITests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
EAC304A72D76692F00D9006D /* EmployeeDirectory */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = EAC304CC2D76693000D9006D /* Build configuration list for PBXNativeTarget "EmployeeDirectory" */;
|
||||
buildPhases = (
|
||||
EAC304A42D76692F00D9006D /* Sources */,
|
||||
EAC304A52D76692F00D9006D /* Frameworks */,
|
||||
EAC304A62D76692F00D9006D /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
EAC304AA2D76692F00D9006D /* EmployeeDirectory */,
|
||||
);
|
||||
name = EmployeeDirectory;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = EmployeeDirectory;
|
||||
productReference = EAC304A82D76692F00D9006D /* EmployeeDirectory.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
EAC304B72D76693000D9006D /* EmployeeDirectoryTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = EAC304CF2D76693000D9006D /* Build configuration list for PBXNativeTarget "EmployeeDirectoryTests" */;
|
||||
buildPhases = (
|
||||
EAC304B42D76693000D9006D /* Sources */,
|
||||
EAC304B52D76693000D9006D /* Frameworks */,
|
||||
EAC304B62D76693000D9006D /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
EAC304BA2D76693000D9006D /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
EAC304BB2D76693000D9006D /* EmployeeDirectoryTests */,
|
||||
);
|
||||
name = EmployeeDirectoryTests;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = EmployeeDirectoryTests;
|
||||
productReference = EAC304B82D76693000D9006D /* EmployeeDirectoryTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
EAC304C12D76693000D9006D /* EmployeeDirectoryUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = EAC304D22D76693000D9006D /* Build configuration list for PBXNativeTarget "EmployeeDirectoryUITests" */;
|
||||
buildPhases = (
|
||||
EAC304BE2D76693000D9006D /* Sources */,
|
||||
EAC304BF2D76693000D9006D /* Frameworks */,
|
||||
EAC304C02D76693000D9006D /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
EAC304C42D76693000D9006D /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
EAC304C52D76693000D9006D /* EmployeeDirectoryUITests */,
|
||||
);
|
||||
name = EmployeeDirectoryUITests;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = EmployeeDirectoryUITests;
|
||||
productReference = EAC304C22D76693000D9006D /* EmployeeDirectoryUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
EAC304A02D76692F00D9006D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1620;
|
||||
LastUpgradeCheck = 1620;
|
||||
TargetAttributes = {
|
||||
EAC304A72D76692F00D9006D = {
|
||||
CreatedOnToolsVersion = 16.2;
|
||||
};
|
||||
EAC304B72D76693000D9006D = {
|
||||
CreatedOnToolsVersion = 16.2;
|
||||
TestTargetID = EAC304A72D76692F00D9006D;
|
||||
};
|
||||
EAC304C12D76693000D9006D = {
|
||||
CreatedOnToolsVersion = 16.2;
|
||||
TestTargetID = EAC304A72D76692F00D9006D;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = EAC304A32D76692F00D9006D /* Build configuration list for PBXProject "EmployeeDirectory" */;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = EAC3049F2D76692F00D9006D;
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = EAC304A92D76692F00D9006D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
EAC304A72D76692F00D9006D /* EmployeeDirectory */,
|
||||
EAC304B72D76693000D9006D /* EmployeeDirectoryTests */,
|
||||
EAC304C12D76693000D9006D /* EmployeeDirectoryUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
EAC304A62D76692F00D9006D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EAC304B62D76693000D9006D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EAC304C02D76693000D9006D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
EAC304A42D76692F00D9006D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EAC304B42D76693000D9006D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EAC304BE2D76693000D9006D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
EAC304BA2D76693000D9006D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EAC304A72D76692F00D9006D /* EmployeeDirectory */;
|
||||
targetProxy = EAC304B92D76693000D9006D /* PBXContainerItemProxy */;
|
||||
};
|
||||
EAC304C42D76693000D9006D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EAC304A72D76692F00D9006D /* EmployeeDirectory */;
|
||||
targetProxy = EAC304C32D76693000D9006D /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
EAC304CA2D76693000D9006D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
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 = 18.2;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EAC304CB2D76693000D9006D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
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 = 18.2;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
EAC304CD2D76693000D9006D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"EmployeeDirectory/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 6R7KLBPBLZ;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = EmployeeDirectory/Info.plist;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mbrucedogs.EmployeeDirectory;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EAC304CE2D76693000D9006D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"EmployeeDirectory/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 6R7KLBPBLZ;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = EmployeeDirectory/Info.plist;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mbrucedogs.EmployeeDirectory;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
EAC304D02D76693000D9006D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 6R7KLBPBLZ;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mbrucedogs.EmployeeDirectoryTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EmployeeDirectory.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/EmployeeDirectory";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EAC304D12D76693000D9006D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 6R7KLBPBLZ;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mbrucedogs.EmployeeDirectoryTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EmployeeDirectory.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/EmployeeDirectory";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
EAC304D32D76693000D9006D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 6R7KLBPBLZ;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mbrucedogs.EmployeeDirectoryUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = EmployeeDirectory;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EAC304D42D76693000D9006D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 6R7KLBPBLZ;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mbrucedogs.EmployeeDirectoryUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = EmployeeDirectory;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
EAC304A32D76692F00D9006D /* Build configuration list for PBXProject "EmployeeDirectory" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EAC304CA2D76693000D9006D /* Debug */,
|
||||
EAC304CB2D76693000D9006D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
EAC304CC2D76693000D9006D /* Build configuration list for PBXNativeTarget "EmployeeDirectory" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EAC304CD2D76693000D9006D /* Debug */,
|
||||
EAC304CE2D76693000D9006D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
EAC304CF2D76693000D9006D /* Build configuration list for PBXNativeTarget "EmployeeDirectoryTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EAC304D02D76693000D9006D /* Debug */,
|
||||
EAC304D12D76693000D9006D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
EAC304D22D76693000D9006D /* Build configuration list for PBXNativeTarget "EmployeeDirectoryUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EAC304D32D76693000D9006D /* Debug */,
|
||||
EAC304D42D76693000D9006D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = EAC304A02D76692F00D9006D /* Project object */;
|
||||
}
|
||||
7
EmployeeDirectory.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
EmployeeDirectory.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
uuid = "BCD20A5B-B7B0-4775-A851-C44BE1718BD6"
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>EmployeeDirectory.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "tinted"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
6
EmployeeDirectory/Assets.xcassets/Contents.json
Normal file
6
EmployeeDirectory/Assets.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
17
EmployeeDirectory/EmployeeDirectoryApp.swift
Normal file
17
EmployeeDirectory/EmployeeDirectoryApp.swift
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// EmployeeDirectoryApp.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct EmployeeDirectoryApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
EmployeeListView()
|
||||
}
|
||||
}
|
||||
}
|
||||
26
EmployeeDirectory/Extensions/String.swift
Normal file
26
EmployeeDirectory/Extensions/String.swift
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// String.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/4/25.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
/// Formats a string into a US phone number format (XXX-XXX-XXXX).
|
||||
/// Non-numeric characters are removed, and formatting is applied based on the length of the string.
|
||||
/// - Returns: A formatted phone number as a string.
|
||||
internal func formatUSNumber() -> String {
|
||||
let mask = "XXX-XXX-XXXX"
|
||||
let digits = filter { $0.isNumber }
|
||||
var index = digits.startIndex
|
||||
return mask.reduce(into: "") { result, char in
|
||||
if char == "X", index < digits.endIndex {
|
||||
result.append(digits[index])
|
||||
index = digits.index(after: index)
|
||||
} else {
|
||||
result.append(char)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
EmployeeDirectory/Info.plist
Normal file
19
EmployeeDirectory/Info.plist
Normal file
@ -0,0 +1,19 @@
|
||||
<?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>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>dummyimage.com</key>
|
||||
<dict>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
50
EmployeeDirectory/Models/Employee.swift
Normal file
50
EmployeeDirectory/Models/Employee.swift
Normal file
@ -0,0 +1,50 @@
|
||||
//
|
||||
// Employee.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// Employee Object
|
||||
/// JSON Object defintion
|
||||
/// - https://square.github.io/microsite/mobile-interview-project/
|
||||
public struct Employee: Identifiable, Hashable, Codable {
|
||||
public var id: UUID { uuid }
|
||||
|
||||
/// The unique identifier for the employee. Represented as a UUID.
|
||||
public let uuid: UUID
|
||||
|
||||
/// The first name of the employee.
|
||||
public let firstName: String
|
||||
|
||||
/// The last name of the employee.
|
||||
public let lastName: String
|
||||
|
||||
/// The phone number of the employee, sent as an unformatted string (eg, 5556661234).
|
||||
public let phoneNumber: String?
|
||||
|
||||
/// The email address of the employee.
|
||||
public let emailAddress: String
|
||||
|
||||
/// A short, tweet-length (~300 chars) string that the employee provided to describe themselves.
|
||||
public let biography: String?
|
||||
|
||||
/// The URL of the employee’s small photo. Useful for list view.
|
||||
public let photoURLSmall: String?
|
||||
|
||||
/// The URL of the employee’s full-size photo.
|
||||
public let photoURLLarge: String?
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case uuid
|
||||
case firstName = "first_name"
|
||||
case lastName = "last_name"
|
||||
case phoneNumber = "phone_number"
|
||||
case emailAddress = "email_address"
|
||||
case biography
|
||||
case photoURLSmall = "photo_url_small"
|
||||
case photoURLLarge = "photo_url_large"
|
||||
}
|
||||
}
|
||||
|
||||
14
EmployeeDirectory/Models/Employees.swift
Normal file
14
EmployeeDirectory/Models/Employees.swift
Normal file
@ -0,0 +1,14 @@
|
||||
//
|
||||
// Employees.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// Wrapper JSON Class for the Employees
|
||||
public struct Employees: Codable {
|
||||
/// Array of Employees
|
||||
public var result: [Employee]
|
||||
public var hasNextPage: Bool = false
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
10
EmployeeDirectory/Protocols/EmployeeServiceProtocol.swift
Normal file
10
EmployeeDirectory/Protocols/EmployeeServiceProtocol.swift
Normal file
@ -0,0 +1,10 @@
|
||||
//
|
||||
// EmployeeServiceProtocol.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
public protocol EmployeeServiceProtocol {
|
||||
func getUsers(page: Int?) async throws -> Employees
|
||||
}
|
||||
76
EmployeeDirectory/Services/EmployeeService.swift
Normal file
76
EmployeeDirectory/Services/EmployeeService.swift
Normal file
@ -0,0 +1,76 @@
|
||||
//
|
||||
// EmployeeService.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
public class EmployeeService: EmployeeServiceProtocol {
|
||||
// MARK: - Properties
|
||||
public static let shared = EmployeeService() // Default shared instance
|
||||
|
||||
// MARK: - Initializer
|
||||
|
||||
public init() {}
|
||||
|
||||
// MARK: - Public Methods
|
||||
|
||||
/// This will get a list of all employees
|
||||
/// - Returns: An Employees struct
|
||||
public func getUsers(page: Int? = nil) async throws -> Employees {
|
||||
var endpoint = "https://my.api.mockaroo.com/users.json?key=f298b840"
|
||||
if let page {
|
||||
endpoint += "&page=\(page)"
|
||||
}
|
||||
|
||||
//ensure a valid URL
|
||||
guard let url = URL(string: endpoint) else {
|
||||
throw URLError(.badURL)
|
||||
}
|
||||
|
||||
// Perform network request
|
||||
let (data, response) = try await URLSession.shared.data(from: url)
|
||||
|
||||
// Validate HTTP response
|
||||
guard let httpResponse = response as? HTTPURLResponse,
|
||||
200..<300 ~= httpResponse.statusCode else {
|
||||
throw URLError(.badServerResponse)
|
||||
}
|
||||
|
||||
// Decode the response into the specified type
|
||||
return try JSONDecoder().decode(Employees.self, from: data)
|
||||
}
|
||||
}
|
||||
|
||||
// Mock Service Implementation for testing & previews.
|
||||
struct MockEmployeeService: EmployeeServiceProtocol {
|
||||
static let sample = createUser(page: 1, index: 1)
|
||||
|
||||
static func createUser(page: Int?, index: Int) -> Employee {
|
||||
Employee(
|
||||
uuid: UUID(),
|
||||
firstName: "First \(index + ((page ?? 1) - 1) * 20)",
|
||||
lastName: "Last \(index + ((page ?? 1) - 1) * 20)",
|
||||
phoneNumber: "555555\(1000 + index)",
|
||||
emailAddress: "user\(index)@example.com",
|
||||
biography: "Biography for employee \(index)",
|
||||
photoURLSmall: "https://example.com/photo_small.jpg",
|
||||
photoURLLarge: "https://example.com/photo_large.jpg"
|
||||
)
|
||||
}
|
||||
func getUsers(page: Int?) async throws -> Employees {
|
||||
// Simulate network delay.
|
||||
try await Task.sleep(nanoseconds: 500_000_000)
|
||||
|
||||
// Create dummy data (20 employees per page).
|
||||
let dummyEmployees: [Employee] = (0..<20).map { i in
|
||||
Self.createUser(page: page, index: i)
|
||||
}
|
||||
|
||||
// Simulate that there are more pages if page is less than 5.
|
||||
let hasNext = (page ?? 1) < 5
|
||||
|
||||
return Employees(result: dummyEmployees, hasNextPage: hasNext)
|
||||
}
|
||||
}
|
||||
35
EmployeeDirectory/ViewModels/EmployeeViewModel.swift
Normal file
35
EmployeeDirectory/ViewModels/EmployeeViewModel.swift
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// EmployeeViewModel.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
@MainActor
|
||||
public class EmployeeViewModel {
|
||||
// MARK: - Properties
|
||||
|
||||
private let employee: Employee
|
||||
|
||||
public private(set) var uuid: String
|
||||
public private(set) var fullName: String
|
||||
public private(set) var phoneNumber: String?
|
||||
public private(set) var emailAddress: String
|
||||
public private(set) var biography: String?
|
||||
public private(set) var smallPhoto: String?
|
||||
public private(set) var largePhoto: String?
|
||||
|
||||
// MARK: - Initializer
|
||||
public init(employee: Employee) {
|
||||
self.employee = employee
|
||||
uuid = employee.uuid.uuidString
|
||||
fullName = "\(employee.firstName) \(employee.lastName)"
|
||||
phoneNumber = employee.phoneNumber?.formatUSNumber()
|
||||
emailAddress = employee.emailAddress
|
||||
biography = employee.biography
|
||||
smallPhoto = employee.photoURLSmall
|
||||
largePhoto = employee.photoURLLarge
|
||||
}
|
||||
}
|
||||
40
EmployeeDirectory/ViewModels/EmployeesViewModel.swift
Normal file
40
EmployeeDirectory/ViewModels/EmployeesViewModel.swift
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// EmployeesViewModel.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
/// ViewModel that will be bound to an Employees model and used
|
||||
/// specifically with the EmployeesViewController.
|
||||
@MainActor
|
||||
public class EmployeesViewModel: ObservableObject {
|
||||
@Published var employees: [Employee] = []
|
||||
@Published var isLoading = false
|
||||
@Published var hasNextPage = false
|
||||
|
||||
private var currentPage = 1
|
||||
let service: EmployeeServiceProtocol
|
||||
|
||||
init(service: EmployeeServiceProtocol) {
|
||||
self.service = service
|
||||
}
|
||||
|
||||
/// Loads the next page of employees.
|
||||
func loadEmployees() async {
|
||||
guard !isLoading else { return }
|
||||
isLoading = true
|
||||
do {
|
||||
let response = try await service.getUsers(page: currentPage)
|
||||
employees.append(contentsOf: response.result)
|
||||
hasNextPage = response.hasNextPage
|
||||
currentPage += 1
|
||||
} catch {
|
||||
print("Error loading employees: \(error)")
|
||||
}
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
80
EmployeeDirectory/Views/ContactButtonView.swift
Normal file
80
EmployeeDirectory/Views/ContactButtonView.swift
Normal file
@ -0,0 +1,80 @@
|
||||
//
|
||||
// ContactButtonView.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/4/25.
|
||||
//
|
||||
import SwiftUI
|
||||
|
||||
enum ContactType {
|
||||
case phone, email
|
||||
}
|
||||
|
||||
struct ContactButtonView: View {
|
||||
let contactType: ContactType
|
||||
let contactValue: String
|
||||
let enabled: Bool
|
||||
|
||||
init(contactType: ContactType, contactValue: String, enabled: Bool = true) {
|
||||
self.contactType = contactType
|
||||
self.contactValue = contactValue
|
||||
self.enabled = enabled
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if !enabled {
|
||||
Label(labelText(for: contactValue), systemImage: iconName)
|
||||
.foregroundColor(.gray)
|
||||
.font(.caption)
|
||||
} else {
|
||||
Button(action: {
|
||||
if let url = URL(string: urlString(for: contactValue)) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}) {
|
||||
Label(labelText(for: contactValue), systemImage: iconName)
|
||||
.foregroundColor(.blue)
|
||||
.font(.caption)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private var iconName: String {
|
||||
switch contactType {
|
||||
case .phone:
|
||||
return "phone.fill"
|
||||
case .email:
|
||||
return "envelope.fill"
|
||||
}
|
||||
}
|
||||
|
||||
private func labelText(for value: String) -> String {
|
||||
switch contactType {
|
||||
case .phone:
|
||||
return "Call \(value)"
|
||||
case .email:
|
||||
return "Email \(value)"
|
||||
}
|
||||
}
|
||||
|
||||
private func urlString(for value: String) -> String {
|
||||
switch contactType {
|
||||
case .phone:
|
||||
return "tel://\(value)"
|
||||
case .email:
|
||||
return "mailto:\(value)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#Preview {
|
||||
VStack (alignment: .leading) {
|
||||
Text("Phone Number:")
|
||||
ContactButtonView(contactType: .phone, contactValue: MockEmployeeService.sample.phoneNumber!.formatUSNumber()).padding()
|
||||
Text("Email Address:")
|
||||
ContactButtonView(contactType: .email, contactValue: MockEmployeeService.sample.emailAddress).padding()
|
||||
}
|
||||
}
|
||||
43
EmployeeDirectory/Views/EmployeeDetailsView.swift
Normal file
43
EmployeeDirectory/Views/EmployeeDetailsView.swift
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// EmployeeDetailsView.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/4/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct EmployeeDetailsView: View {
|
||||
let viewModel: EmployeeViewModel
|
||||
let defaultImage = "person.circle.fill" // SF Symbol as fallback
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
// Profile Image with Default Placeholder
|
||||
ProfileImageView(urlString: viewModel.largePhoto, size: 250) // Uses reusable component
|
||||
.padding(.bottom)
|
||||
Text(viewModel.fullName)
|
||||
.font(.headline)
|
||||
|
||||
if let bio = viewModel.biography {
|
||||
Text(bio)
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
.lineLimit(2)
|
||||
}
|
||||
|
||||
ContactButtonView(contactType: .email, contactValue: viewModel.emailAddress)
|
||||
|
||||
if let phone = viewModel.phoneNumber {
|
||||
ContactButtonView(contactType: .phone, contactValue: phone)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(.all)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
EmployeeDetailsView(viewModel: .init(employee: MockEmployeeService.sample)).padding(.all)
|
||||
}
|
||||
|
||||
49
EmployeeDirectory/Views/EmployeeListView.swift
Normal file
49
EmployeeDirectory/Views/EmployeeListView.swift
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
struct EmployeeListView: View {
|
||||
@StateObject public var viewModel: EmployeesViewModel
|
||||
|
||||
// Dependency injection via the initializer.
|
||||
init(viewModel: EmployeesViewModel? = nil) {
|
||||
_viewModel = StateObject(wrappedValue: viewModel ?? .init(service: EmployeeService()))
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
List {
|
||||
ForEach(viewModel.employees) { employee in
|
||||
NavigationLink(destination: EmployeeDetailsView(viewModel: .init(employee: employee))) {
|
||||
EmployeeRowView(viewModel: .init(employee: employee))
|
||||
}
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
if viewModel.hasNextPage {
|
||||
ProgressView()
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.task {
|
||||
await viewModel.loadEmployees()
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Employees")
|
||||
.listStyle(.plain)
|
||||
}
|
||||
.task {
|
||||
if viewModel.employees.isEmpty {
|
||||
await viewModel.loadEmployees()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
EmployeeListView(viewModel: .init(service: MockEmployeeService()))
|
||||
}
|
||||
47
EmployeeDirectory/Views/EmployeeRowView.swift
Normal file
47
EmployeeDirectory/Views/EmployeeRowView.swift
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// EmployeeRowView.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct EmployeeRowView: View {
|
||||
let viewModel: EmployeeViewModel
|
||||
let defaultImage = "person.circle.fill" // SF Symbol as fallback
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .top, spacing: 12) {
|
||||
// Profile Image with Default Placeholder
|
||||
ProfileImageView(urlString: viewModel.smallPhoto, size: 50) // Uses reusable component
|
||||
|
||||
// Employee Info Stack
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(viewModel.fullName)
|
||||
.font(.headline)
|
||||
|
||||
if let bio = viewModel.biography {
|
||||
Text(bio)
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
.lineLimit(2)
|
||||
}
|
||||
|
||||
ContactButtonView(contactType: .email, contactValue: viewModel.emailAddress, enabled: false)
|
||||
|
||||
if let phone = viewModel.phoneNumber {
|
||||
ContactButtonView(contactType: .phone, contactValue: phone, enabled: false)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer() // Pushes everything to the left
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
EmployeeRowView(viewModel: .init(employee: MockEmployeeService.sample)).padding()
|
||||
}
|
||||
|
||||
37
EmployeeDirectory/Views/ProfileImageView.swift
Normal file
37
EmployeeDirectory/Views/ProfileImageView.swift
Normal file
@ -0,0 +1,37 @@
|
||||
//
|
||||
// ProfileImageView.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ProfileImageView: View {
|
||||
let urlString: String?
|
||||
let size: CGFloat // Allows us to customize the image size
|
||||
|
||||
private let defaultImage = "person.circle.fill" // SF Symbol
|
||||
|
||||
var body: some View {
|
||||
AsyncImage(url: URL(string: urlString ?? "")) { phase in
|
||||
if let image = phase.image {
|
||||
image.resizable()
|
||||
} else if phase.error != nil || urlString == nil {
|
||||
Image(systemName: defaultImage)
|
||||
.resizable()
|
||||
.foregroundColor(.gray)
|
||||
} else {
|
||||
ProgressView() // Show loader while fetching
|
||||
}
|
||||
}
|
||||
.scaledToFill()
|
||||
.frame(width: size, height: size)
|
||||
.clipShape(Circle()) // Rounded shape
|
||||
.overlay(Circle().stroke(Color.gray, lineWidth: 1)) // Border
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ProfileImageView(urlString: MockEmployeeService.sample.photoURLSmall, size: 100).padding()
|
||||
}
|
||||
17
EmployeeDirectoryTests/EmployeeDirectoryTests.swift
Normal file
17
EmployeeDirectoryTests/EmployeeDirectoryTests.swift
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// EmployeeDirectoryTests.swift
|
||||
// EmployeeDirectoryTests
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
import Testing
|
||||
@testable import EmployeeDirectory
|
||||
|
||||
struct EmployeeDirectoryTests {
|
||||
|
||||
@Test func example() async throws {
|
||||
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
|
||||
}
|
||||
|
||||
}
|
||||
43
EmployeeDirectoryUITests/EmployeeDirectoryUITests.swift
Normal file
43
EmployeeDirectoryUITests/EmployeeDirectoryUITests.swift
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// EmployeeDirectoryUITests.swift
|
||||
// EmployeeDirectoryUITests
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class EmployeeDirectoryUITests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
|
||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testExample() throws {
|
||||
// UI tests must launch the application that they test.
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunchPerformance() throws {
|
||||
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
|
||||
// This measures how long it takes to launch your application.
|
||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
||||
XCUIApplication().launch()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
//
|
||||
// EmployeeDirectoryUITestsLaunchTests.swift
|
||||
// EmployeeDirectoryUITests
|
||||
//
|
||||
// Created by Matt Bruce on 3/3/25.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class EmployeeDirectoryUITestsLaunchTests: XCTestCase {
|
||||
|
||||
override class var runsForEachTargetApplicationUIConfiguration: Bool {
|
||||
true
|
||||
}
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunch() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Insert steps here to perform after app launch but before taking a screenshot,
|
||||
// such as logging into a test account or navigating somewhere in the app
|
||||
|
||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
||||
attachment.name = "Launch Screen"
|
||||
attachment.lifetime = .keepAlways
|
||||
add(attachment)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user