Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ jobs:
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.2.0'
xcode-version: '16.4'
- uses: actions/checkout@v3
- name: Unit Tests
run: xcodebuild -project NativeAppTemplate.xcodeproj -scheme "NativeAppTemplate" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.2' test
- name: Install SwiftLint
run: |
brew install swiftlint
# Commented out due to an error.
# - name: Unit Tests
# run: |
# xcodebuild -project NativeAppTemplate.xcodeproj \
# -scheme "NativeAppTemplate" \
# -sdk iphonesimulator \
# -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.2' \
# -quiet \
# test
90 changes: 35 additions & 55 deletions NativeAppTemplate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 77;
objectVersion = 90;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -306,22 +306,18 @@
/* Begin PBXFrameworksBuildPhase section */
011F6DEA259EF16400BED22E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
012009FC299F1E190078A1F9 /* OrderedCollections in Frameworks */,
012009F8299F1E190078A1F9 /* Collections in Frameworks */,
012009FA299F1E190078A1F9 /* DequeModule in Frameworks */,
0172030225A9634F008FD63B /* SwiftyJSON in Frameworks */,
0182D37025B258A7001E881D /* KeychainAccess in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
01D19B402D4DE33500BDEAB7 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

Expand Down Expand Up @@ -787,8 +783,6 @@
);
buildRules = (
);
dependencies = (
);
name = NativeAppTemplate;
packageProductDependencies = (
0172030125A9634F008FD63B /* SwiftyJSON */,
Expand Down Expand Up @@ -818,8 +812,6 @@
01D19B442D4DE33500BDEAB7 /* NativeAppTemplateTests */,
);
name = NativeAppTemplateTests;
packageProductDependencies = (
);
productName = NativeAppTemplateTests;
productReference = 01D19B432D4DE33500BDEAB7 /* NativeAppTemplateTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand Down Expand Up @@ -857,7 +849,7 @@
0182D36E25B258A7001E881D /* XCRemoteSwiftPackageReference "KeychainAccess" */,
012009F6299F1E190078A1F9 /* XCRemoteSwiftPackageReference "swift-collections" */,
);
preferredProjectObjectVersion = 77;
preferredProjectObjectVersion = 90;
productRefGroup = 011F6DEE259EF16400BED22E /* Products */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -871,52 +863,46 @@
/* Begin PBXResourcesBuildPhase section */
011F6DEB259EF16400BED22E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
015C78052B72DA2C00B6523C /* PrivacyInfo.xcprivacy in Resources */,
018D4EFF2B6350F500CBA736 /* Inter-Bold.ttf in Resources */,
018D4EFD2B6350E800CBA736 /* Inter-Medium.ttf in Resources */,
011F6DF8259EF16600BED22E /* Preview Assets.xcassets in Resources */,
011F6DF5259EF16600BED22E /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
01D19B412D4DE33500BDEAB7 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0135E8E42D7E4478004AD8FA /* SampleCode.xcconfig in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
01A77D352632D1D900352EBC /* SwiftLint Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "SwiftLint Run Script";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which swiftlint > /dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = (
"if [[ \"$(uname -m)\" == arm64 ]]; then",
" export PATH=\"/opt/homebrew/bin:$PATH\"",
"fi",
"",
"if which swiftlint > /dev/null; then",
" swiftlint",
"else",
" echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"",
"fi",
"",
);
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
011F6DE9259EF16400BED22E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0172047925AA8335008FD63B /* UIFont+Extensions.swift in Sources */,
01E2477029A570D300D4B00D /* SignUp.swift in Sources */,
Expand Down Expand Up @@ -1045,14 +1031,11 @@
0172046725AA82BF008FD63B /* MainView.swift in Sources */,
0172033825A9642E008FD63B /* JSONAPIError.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
01D19B3F2D4DE33500BDEAB7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

Expand All @@ -1065,7 +1048,7 @@
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
011F6E10259EF16600BED22E /* Debug */ = {
011F6E10259EF16600BED22E /* Debug configuration for PBXProject "NativeAppTemplate" */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
Expand Down Expand Up @@ -1133,7 +1116,7 @@
};
name = Debug;
};
011F6E11259EF16600BED22E /* Release */ = {
011F6E11259EF16600BED22E /* Release configuration for PBXProject "NativeAppTemplate" */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
Expand Down Expand Up @@ -1195,7 +1178,7 @@
};
name = Release;
};
011F6E13259EF16600BED22E /* Debug */ = {
011F6E13259EF16600BED22E /* Debug configuration for PBXNativeTarget "NativeAppTemplate" */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
Expand All @@ -1204,7 +1187,7 @@
CODE_SIGN_ENTITLEMENTS = NativeAppTemplate/NativeAppTemplate.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_ASSET_PATHS = "\"NativeAppTemplate/Preview Content\"";
DEVELOPMENT_TEAM = NNYDL5U3V3;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1232,7 +1215,7 @@
};
name = Debug;
};
011F6E14259EF16600BED22E /* Release */ = {
011F6E14259EF16600BED22E /* Release configuration for PBXNativeTarget "NativeAppTemplate" */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
Expand All @@ -1241,7 +1224,7 @@
CODE_SIGN_ENTITLEMENTS = NativeAppTemplate/NativeAppTemplate.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_ASSET_PATHS = "\"NativeAppTemplate/Preview Content\"";
DEVELOPMENT_TEAM = NNYDL5U3V3;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1269,7 +1252,7 @@
};
name = Release;
};
016595AF2824E3D800203F7F /* Beta */ = {
016595AF2824E3D800203F7F /* Beta configuration for PBXProject "NativeAppTemplate" */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
Expand Down Expand Up @@ -1331,15 +1314,15 @@
};
name = Beta;
};
016595B02824E3D800203F7F /* Beta */ = {
016595B02824E3D800203F7F /* Beta configuration for PBXNativeTarget "NativeAppTemplate" */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "";
BUNDLE_ID_SUFFIX = .beta;
CODE_SIGN_ENTITLEMENTS = NativeAppTemplate/NativeAppTemplate.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_ASSET_PATHS = "\"NativeAppTemplate/Preview Content\"";
DEVELOPMENT_TEAM = NNYDL5U3V3;
ENABLE_PREVIEWS = YES;
Expand All @@ -1365,7 +1348,7 @@
};
name = Beta;
};
01D19B4A2D4DE33500BDEAB7 /* Debug */ = {
01D19B4A2D4DE33500BDEAB7 /* Debug configuration for PBXNativeTarget "NativeAppTemplateTests" */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
Expand All @@ -1387,7 +1370,7 @@
};
name = Debug;
};
01D19B4B2D4DE33500BDEAB7 /* Release */ = {
01D19B4B2D4DE33500BDEAB7 /* Release configuration for PBXNativeTarget "NativeAppTemplateTests" */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
Expand All @@ -1408,7 +1391,7 @@
};
name = Release;
};
01D19B4C2D4DE33500BDEAB7 /* Beta */ = {
01D19B4C2D4DE33500BDEAB7 /* Beta configuration for PBXNativeTarget "NativeAppTemplateTests" */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
Expand All @@ -1435,31 +1418,28 @@
011F6DE8259EF16400BED22E /* Build configuration list for PBXProject "NativeAppTemplate" */ = {
isa = XCConfigurationList;
buildConfigurations = (
011F6E10259EF16600BED22E /* Debug */,
011F6E11259EF16600BED22E /* Release */,
016595AF2824E3D800203F7F /* Beta */,
011F6E10259EF16600BED22E /* Debug configuration for PBXProject "NativeAppTemplate" */,
011F6E11259EF16600BED22E /* Release configuration for PBXProject "NativeAppTemplate" */,
016595AF2824E3D800203F7F /* Beta configuration for PBXProject "NativeAppTemplate" */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
011F6E12259EF16600BED22E /* Build configuration list for PBXNativeTarget "NativeAppTemplate" */ = {
isa = XCConfigurationList;
buildConfigurations = (
011F6E13259EF16600BED22E /* Debug */,
011F6E14259EF16600BED22E /* Release */,
016595B02824E3D800203F7F /* Beta */,
011F6E13259EF16600BED22E /* Debug configuration for PBXNativeTarget "NativeAppTemplate" */,
011F6E14259EF16600BED22E /* Release configuration for PBXNativeTarget "NativeAppTemplate" */,
016595B02824E3D800203F7F /* Beta configuration for PBXNativeTarget "NativeAppTemplate" */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
01D19B492D4DE33500BDEAB7 /* Build configuration list for PBXNativeTarget "NativeAppTemplateTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
01D19B4A2D4DE33500BDEAB7 /* Debug */,
01D19B4B2D4DE33500BDEAB7 /* Release */,
01D19B4C2D4DE33500BDEAB7 /* Beta */,
01D19B4A2D4DE33500BDEAB7 /* Debug configuration for PBXNativeTarget "NativeAppTemplateTests" */,
01D19B4B2D4DE33500BDEAB7 /* Release configuration for PBXNativeTarget "NativeAppTemplateTests" */,
01D19B4C2D4DE33500BDEAB7 /* Beta configuration for PBXNativeTarget "NativeAppTemplateTests" */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
Expand Down
6 changes: 4 additions & 2 deletions NativeAppTemplate/Data/Repositories/ItemTagRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ import SwiftUI
do {
let itemTag = try await itemTagsService.itemTagDetail(id: id)
let itemTagIndex = (itemTags.firstIndex { $0.id == itemTag.id })
if itemTagIndex != nil {
if itemTagIndex == nil {
itemTags.append(itemTag)
} else {
itemTags[itemTagIndex!] = itemTag
}

return itemTag
} catch {
Failure
Expand Down
6 changes: 4 additions & 2 deletions NativeAppTemplate/Data/Repositories/ShopRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ import SwiftUI
do {
let shop = try await shopsService.shopDetail(id: id)
let shopIndex = (shops.firstIndex { $0.id == shop.id })
if shopIndex != nil {
if shopIndex == nil {
shops.append(shop)
} else {
shops[shopIndex!] = shop
}

return shop
} catch {
Failure
Expand Down