-
Notifications
You must be signed in to change notification settings - Fork 24
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
461f042
d61aff4
bec796e
bfa7d7d
7307e45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,4 +74,4 @@ SPEC CHECKSUMS: | |
|
||
PODFILE CHECKSUM: 240bbaaf597009e1611ff399ef5269ba297f09b1 | ||
|
||
COCOAPODS: 1.11.2 | ||
COCOAPODS: 1.11.3 |
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) | ||
} | ||
/// 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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use shortened style rather than Locale.current here is the rule: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/mobillium/iOS-Guidelines/blob/master/swift-guideline.md There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. explicit return non required There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. explicit return remove ^^ |
||
}() | ||
public var seeAllButtonTapped: ((Int, String) -> Void)? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add |
||
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 | ||
} | ||
} |
There was a problem hiding this comment.
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 thanLocalizable.tr("Favorites", "recipeStats", p1, p2)
for more readabilityThere was a problem hiding this comment.
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.