Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update cell models #46

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion SampleProject/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 240bbaaf597009e1611ff399ef5269ba297f09b1

COCOAPODS: 1.11.2
COCOAPODS: 1.11.3
151 changes: 143 additions & 8 deletions SampleProject/SampleProject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
3D9BC03927BE4BE300DFEFDE /* APIRequestAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D9BC03727BE4BE300DFEFDE /* APIRequestAdapter.swift */; };
3D9BC03A27BE4BE300DFEFDE /* APIDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D9BC03827BE4BE300DFEFDE /* APIDataProvider.swift */; };
3DABD56327429CA30035DCA4 /* CommentCellModel+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DABD56227429CA30035DCA4 /* CommentCellModel+Extensions.swift */; };
3DB49F80289BEBF0003B4769 /* Recipes.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3DB49F7F289BEBF0003B4769 /* Recipes.strings */; };
3DB49F82289BEC09003B4769 /* Favorites.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3DB49F81289BEC09003B4769 /* Favorites.xcassets */; };
3DB49F84289BEC0F003B4769 /* Favorites.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3DB49F83289BEC0F003B4769 /* Favorites.strings */; };
3DB49F86289BF0FF003B4769 /* Localizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DB49F85289BF0FF003B4769 /* Localizable.swift */; };
3DB49F88289BF114003B4769 /* swiftgen.yml in Resources */ = {isa = PBXBuildFile; fileRef = 3DB49F87289BF114003B4769 /* swiftgen.yml */; };
3DD25A50274248770070567E /* APIRequestInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DD25A4F274248770070567E /* APIRequestInterceptor.swift */; };
3DD25A5427424AC50070567E /* APILogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DD25A5327424AC50070567E /* APILogger.swift */; };
3DD25A5627424AF60070567E /* DataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DD25A5527424AF60070567E /* DataProvider.swift */; };
3DF7B0392898026B0012E4A6 /* Recipes.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3DF7B0382898026B0012E4A6 /* Recipes.xcassets */; };
3DFAF37028912EF5005D41A8 /* RecipesCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DFAF36F28912EF5005D41A8 /* RecipesCellModel.swift */; };
3DFAF37728916347005D41A8 /* FavoritesCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DFAF37628916347005D41A8 /* FavoritesCellModel.swift */; };
3DFAF37928916467005D41A8 /* FavoritesRecipeCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DFAF37828916467005D41A8 /* FavoritesRecipeCellModel.swift */; };
5FFC3222261A1327004D4F15 /* LoginWarningPopupRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFC321E261A1327004D4F15 /* LoginWarningPopupRoute.swift */; };
5FFC3223261A1328004D4F15 /* LoginWarningPopupRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFC321F261A1327004D4F15 /* LoginWarningPopupRouter.swift */; };
5FFC3224261A1328004D4F15 /* LoginWarningPopupViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FFC3220261A1327004D4F15 /* LoginWarningPopupViewModel.swift */; };
Expand Down Expand Up @@ -122,9 +131,18 @@
3D9BC03727BE4BE300DFEFDE /* APIRequestAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIRequestAdapter.swift; sourceTree = "<group>"; };
3D9BC03827BE4BE300DFEFDE /* APIDataProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIDataProvider.swift; sourceTree = "<group>"; };
3DABD56227429CA30035DCA4 /* CommentCellModel+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CommentCellModel+Extensions.swift"; sourceTree = "<group>"; };
3DB49F7F289BEBF0003B4769 /* Recipes.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Recipes.strings; sourceTree = "<group>"; };
3DB49F81289BEC09003B4769 /* Favorites.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Favorites.xcassets; sourceTree = "<group>"; };
3DB49F83289BEC0F003B4769 /* Favorites.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Favorites.strings; sourceTree = "<group>"; };
3DB49F85289BF0FF003B4769 /* Localizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Localizable.swift; sourceTree = "<group>"; };
3DB49F87289BF114003B4769 /* swiftgen.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = swiftgen.yml; sourceTree = "<group>"; };
3DD25A4F274248770070567E /* APIRequestInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIRequestInterceptor.swift; sourceTree = "<group>"; };
3DD25A5327424AC50070567E /* APILogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APILogger.swift; sourceTree = "<group>"; };
3DD25A5527424AF60070567E /* DataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataProvider.swift; sourceTree = "<group>"; };
3DF7B0382898026B0012E4A6 /* Recipes.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Recipes.xcassets; sourceTree = "<group>"; };
3DFAF36F28912EF5005D41A8 /* RecipesCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipesCellModel.swift; sourceTree = "<group>"; };
3DFAF37628916347005D41A8 /* FavoritesCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesCellModel.swift; sourceTree = "<group>"; };
3DFAF37828916467005D41A8 /* FavoritesRecipeCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesRecipeCellModel.swift; sourceTree = "<group>"; };
40A466BB3A17D5532723A6F4 /* Pods-SampleProject.development.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleProject.development.xcconfig"; path = "Target Support Files/Pods-SampleProject/Pods-SampleProject.development.xcconfig"; sourceTree = "<group>"; };
469FCAE3662003D1531F1DE0 /* Pods_SampleProject.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SampleProject.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5A2BD542FB24694B7CD6971D /* Pods-SampleProjectTests.development.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleProjectTests.development.xcconfig"; path = "Target Support Files/Pods-SampleProjectTests/Pods-SampleProjectTests.development.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -275,6 +293,90 @@
path = DataProvider;
sourceTree = "<group>";
};
3DFAF36A28912EB3005D41A8 /* Entity */ = {
isa = PBXGroup;
children = (
3DFAF36F28912EF5005D41A8 /* RecipesCellModel.swift */,
);
path = Entity;
sourceTree = "<group>";
};
3DFAF36B28912EBF005D41A8 /* ViewController */ = {
isa = PBXGroup;
children = (
B321F655263188A50082484C /* RecipesViewController.swift */,
);
path = ViewController;
sourceTree = "<group>";
};
3DFAF36C28912EC5005D41A8 /* ViewModel */ = {
isa = PBXGroup;
children = (
B321F653263188A50082484C /* RecipesViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
3DFAF36D28912ECA005D41A8 /* Router */ = {
isa = PBXGroup;
children = (
B321F6742631C8650082484C /* RecipesRouter.swift */,
B321F654263188A50082484C /* RecipesRoute.swift */,
);
path = Router;
sourceTree = "<group>";
};
3DFAF36E28912EDE005D41A8 /* Resources */ = {
isa = PBXGroup;
children = (
3DF7B0382898026B0012E4A6 /* Recipes.xcassets */,
3DB49F7F289BEBF0003B4769 /* Recipes.strings */,
);
path = Resources;
sourceTree = "<group>";
};
3DFAF37128916313005D41A8 /* Entity */ = {
isa = PBXGroup;
children = (
3DFAF37628916347005D41A8 /* FavoritesCellModel.swift */,
3DFAF37828916467005D41A8 /* FavoritesRecipeCellModel.swift */,
);
path = Entity;
sourceTree = "<group>";
};
3DFAF3722891631F005D41A8 /* ViewController */ = {
isa = PBXGroup;
children = (
6CFE5374262ED7DC0008FFCD /* FavoritesViewController.swift */,
);
path = ViewController;
sourceTree = "<group>";
};
3DFAF37328916326005D41A8 /* ViewModel */ = {
isa = PBXGroup;
children = (
6CFE5375262ED7DC0008FFCD /* FavoritesViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
3DFAF3742891632C005D41A8 /* Router */ = {
isa = PBXGroup;
children = (
6CFE5373262ED7DC0008FFCD /* FavoritesRouter.swift */,
);
path = Router;
sourceTree = "<group>";
};
3DFAF37528916332005D41A8 /* Resources */ = {
isa = PBXGroup;
children = (
3DB49F81289BEC09003B4769 /* Favorites.xcassets */,
3DB49F83289BEC0F003B4769 /* Favorites.strings */,
);
path = Resources;
sourceTree = "<group>";
};
5FFC321D261A12EF004D4F15 /* LoginWarning */ = {
isa = PBXGroup;
children = (
Expand All @@ -289,9 +391,11 @@
6CFE5372262ED7BB0008FFCD /* Favorites */ = {
isa = PBXGroup;
children = (
6CFE5374262ED7DC0008FFCD /* FavoritesViewController.swift */,
6CFE5375262ED7DC0008FFCD /* FavoritesViewModel.swift */,
6CFE5373262ED7DC0008FFCD /* FavoritesRouter.swift */,
3DFAF37528916332005D41A8 /* Resources */,
3DFAF3742891632C005D41A8 /* Router */,
3DFAF37328916326005D41A8 /* ViewModel */,
3DFAF3722891631F005D41A8 /* ViewController */,
3DFAF37128916313005D41A8 /* Entity */,
);
path = Favorites;
sourceTree = "<group>";
Expand All @@ -300,6 +404,7 @@
isa = PBXGroup;
children = (
7AFC72A52551FA1A00B30789 /* Assets.xcassets */,
3DB49F85289BF0FF003B4769 /* Localizable.swift */,
);
path = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -404,6 +509,7 @@
7AFC72902551FA1800B30789 = {
isa = PBXGroup;
children = (
3DB49F87289BF114003B4769 /* swiftgen.yml */,
7A6AED8A25A756F900BB1457 /* .swiftlint.yml */,
7AFC729B2551FA1800B30789 /* SampleProject */,
7AFC72B22551FA1A00B30789 /* SampleProjectTests */,
Expand Down Expand Up @@ -635,10 +741,11 @@
B321F651263188A50082484C /* Recipes */ = {
isa = PBXGroup;
children = (
B321F655263188A50082484C /* RecipesViewController.swift */,
B321F653263188A50082484C /* RecipesViewModel.swift */,
B321F6742631C8650082484C /* RecipesRouter.swift */,
B321F654263188A50082484C /* RecipesRoute.swift */,
3DFAF36E28912EDE005D41A8 /* Resources */,
3DFAF36D28912ECA005D41A8 /* Router */,
3DFAF36C28912EC5005D41A8 /* ViewModel */,
3DFAF36B28912EBF005D41A8 /* ViewController */,
3DFAF36A28912EB3005D41A8 /* Entity */,
);
path = Recipes;
sourceTree = "<group>";
Expand Down Expand Up @@ -712,11 +819,12 @@
buildConfigurationList = 7AFC72C32551FA1A00B30789 /* Build configuration list for PBXNativeTarget "SampleProject" */;
buildPhases = (
5C1E2F21BA12D0F9EE72FF47 /* [CP] Check Pods Manifest.lock */,
3DB49F89289BF198003B4769 /* Swiftgen */,
7AFC72952551FA1800B30789 /* Sources */,
7AFC72962551FA1800B30789 /* Frameworks */,
7AFC72972551FA1800B30789 /* Resources */,
7A6AED7025A755AD00BB1457 /* SwiftLint */,
FC4520B3C306F104CC3F94F9 /* [CP] Embed Pods Frameworks */,
7A6AED7025A755AD00BB1457 /* SwiftLint */,
);
buildRules = (
);
Expand Down Expand Up @@ -815,6 +923,11 @@
buildActionMask = 2147483647;
files = (
7AFC72A92551FA1A00B30789 /* LaunchScreen.storyboard in Resources */,
3DB49F88289BF114003B4769 /* swiftgen.yml in Resources */,
3DB49F82289BEC09003B4769 /* Favorites.xcassets in Resources */,
3DB49F84289BEC0F003B4769 /* Favorites.strings in Resources */,
3DF7B0392898026B0012E4A6 /* Recipes.xcassets in Resources */,
3DB49F80289BEBF0003B4769 /* Recipes.strings in Resources */,
7AFC72A62551FA1A00B30789 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -880,6 +993,24 @@
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;
};
3DB49F89289BF198003B4769 /* Swiftgen */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = Swiftgen;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ -f \"${PODS_ROOT}/SwiftGen/bin/swiftgen\" ]]; then\n \"${PODS_ROOT}/SwiftGen/bin/swiftgen\"\nelse\n echo \"warning: SwiftGen is not installed. Run 'pod install --repo-update' to install it.\"\nfi\n";
};
50B90769EF34456AFD69D8E2 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -968,6 +1099,7 @@
A2D7BB582665126600E3F3A2 /* CommentListRoute.swift in Sources */,
A29A02D42660F5810078F2FA /* MainTabBarController.swift in Sources */,
7A980AB72553168400494520 /* HomeViewController.swift in Sources */,
3DFAF37728916347005D41A8 /* FavoritesCellModel.swift in Sources */,
840EB5AA264589790019C101 /* SKPhotoBrowserRoute.swift in Sources */,
A2D7BB442664F3F000E3F3A2 /* Validation.swift in Sources */,
7A980AF02553171A00494520 /* PushTransition.swift in Sources */,
Expand All @@ -985,13 +1117,15 @@
7A980AB82553168400494520 /* HomeViewModel.swift in Sources */,
A2D7BB67266524E200E3F3A2 /* CommentEditRouter.swift in Sources */,
A2176A2726161623008B3C46 /* WalkThroughViewController.swift in Sources */,
3DFAF37028912EF5005D41A8 /* RecipesCellModel.swift in Sources */,
3D9BC03927BE4BE300DFEFDE /* APIRequestAdapter.swift in Sources */,
7A980AB62553168400494520 /* HomeRouter.swift in Sources */,
7AC7AC3025CD49F700EA44C4 /* DateFormats.swift in Sources */,
5FFC3222261A1327004D4F15 /* LoginWarningPopupRoute.swift in Sources */,
A2463331266A1F4A00F85CB4 /* ShareSheetRoute.swift in Sources */,
A2176A2826161623008B3C46 /* WalkThroughViewModel.swift in Sources */,
7A980AF12553171A00494520 /* Transition.swift in Sources */,
3DFAF37928916467005D41A8 /* FavoritesRecipeCellModel.swift in Sources */,
7AFCDEA9261615A600D5D115 /* RecipeDetailViewModel.swift in Sources */,
7A980AFC2553178000494520 /* AppRouter.swift in Sources */,
B321F658263188A50082484C /* RecipesRoute.swift in Sources */,
Expand Down Expand Up @@ -1028,6 +1162,7 @@
7A980B3325531F9600494520 /* HomeRoute.swift in Sources */,
3D9BC03A27BE4BE300DFEFDE /* APIDataProvider.swift in Sources */,
A2D7BB5D266513C900E3F3A2 /* CommentListViewController.swift in Sources */,
3DB49F86289BF0FF003B4769 /* Localizable.swift in Sources */,
3D5DC50A261F52DA002294B7 /* RecipeDetailRoute.swift in Sources */,
A2176A2626161623008B3C46 /* WalkThroughRouter.swift in Sources */,
840EB5B226458B220019C101 /* PhotoBrowserDelegate.swift in Sources */,
Expand Down
58 changes: 58 additions & 0 deletions SampleProject/SampleProject/Resources/Localizable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// swiftlint:disable all
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen

import Foundation

// swiftlint:disable superfluous_disable_command file_length implicit_return

// MARK: - Strings

// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces
internal enum Localizable {
internal enum Favorites {
/// %d Yorum %d Beğeni
internal static func recipeStats(_ p1: Int, _ p2: Int) -> String {
return Localizable.tr("Favorites", "recipeStats", p1, p2)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Self.tr... for static method calls, rather than Localizable.tr("Favorites", "recipeStats", p1, p2) for more readability

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is automatically generated by Swiftgen. We do not enforce any rules (swiftlint or style guide) for this file.

}
/// TÜMÜNÜ GÖR
internal static let seeAllButtonTitle = Localizable.tr("Favorites", "seeAllButtonTitle")
/// %d Tarif %d Takipçi
internal static func userStats(_ p1: Int, _ p2: Int) -> String {
return Localizable.tr("Favorites", "userStats", p1, p2)
}
}
internal enum Recipes {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to explicit internal? I'm not sure your requirements right here but it is looking unnecessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is automatically generated by Swiftgen. We do not enforce any rules (swiftlint or style guide) for this file.

/// %d Yorum %d Beğeni
internal static func recipeStats(_ p1: Int, _ p2: Int) -> String {
return Localizable.tr("Recipes", "recipeStats", p1, p2)
}
/// %d Tarif %d Takipçi
internal static func userStats(_ p1: Int, _ p2: Int) -> String {
return Localizable.tr("Recipes", "userStats", p1, p2)
}
}
}
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces

// MARK: - Implementation Details

extension Localizable {
private static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String {
let format = BundleToken.bundle.localizedString(forKey: key, value: nil, table: table)
return String(format: format, locale: Locale.current, arguments: args)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use shortened style rather than Locale.current

here is the rule:
Use compiler inferred context to write shorter, clear code.
https://github.com/mobillium/iOS-Guidelines/blob/master/swift-guideline.md

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is automatically generated by Swiftgen. We do not enforce any rules (swiftlint or style guide) for this file.

}
}

// swiftlint:disable convenience_type
private final class BundleToken {
static let bundle: Bundle = {
#if SWIFT_PACKAGE
return Bundle.module
#else
return Bundle(for: BundleToken.self)
#endif
}()
}
// swiftlint:enable convenience_type
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ In the rest of the project , I saw that 4 lines of indentation were used. But these lines it was 2. Maybe u need to fix that and wanna add to your guidelines for more readability.

https://github.com/mobillium/iOS-Guidelines/blob/master/swift-guideline.md

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is automatically generated by Swiftgen. We do not enforce any rules (swiftlint or style guide) for this file.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension PasswordResetViewModel {
guard let self = self else { return }
self.hideLoading?()
switch result {
case .success(_):
case .success:
self.router.close()
case .failure(let error):
self.showWarningToast?(error.localizedDescription)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension CommentEditViewModel {
guard let self = self else { return }
self.hideLoading?()
switch result {
case .success(_):
case .success:
self.editCommentDidSuccess?(commentText)
self.router.close()
case .failure(let error):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ extension CommentListViewModel {
}

// MARK: - Network
// swiftlint:disable line_length
extension CommentListViewModel {

func fetchComments() {
Expand All @@ -127,7 +126,6 @@ extension CommentListViewModel {
}
}
}
// swiftlint:enable line_length

private func deleteCommentRequest(indexPath: IndexPath) {
let commentId = cellItems[indexPath.row].commentId
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// FavoritesCellModel.swift
// SampleProject
//
// Created by Mehmet Salih Aslan on 27.07.2022.
// Copyright © 2022 Mobillium. All rights reserved.
//

import Foundation

public final class FavoritesCellModel: CategoryWithRecipesCellProtocol {
public var categoryId: Int
public var categoryImageURL: String?
public var categoryName: String?
public var seeAllButtonTitle: String? = {
return Localizable.Favorites.seeAllButtonTitle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit return non required

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit return remove ^^

}()
public var seeAllButtonTapped: ((Int, String) -> Void)?
Copy link

@asilturk asilturk Aug 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think about using typealias like this kind of generic type requirements. would define it, in the global, could improve code reading. extensions are also helpful

Check it out:
SampleProject/SampleProject/Scenes/Recipes/Entity/RecipesCellModel.swift
L: 25 - VoidClosure

Copy link
Collaborator Author

@aslanmehmetsalih aslanmehmetsalih Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add public typealias TwoVariablesClosure<A, B> = ((A, B) -> Void) for this case

public var cellItems: [RecipeSmallCellProtocol]
public var didSelectRecipe: IntClosure?

init(category: MainCategory) {
let cellItems = category.recipes.map({ FavoritesRecipeCellModel(recipe: $0) })
self.categoryId = category.id
self.categoryImageURL = nil
self.categoryName = category.name
self.cellItems = cellItems
}
}
Loading