-
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?
Conversation
let isEditorChoice: Bool | ||
var followButtonTapped: VoidClosure? | ||
|
||
lazy var recipeCommnetAndLikeCountText: String? = { |
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.
Why need to use lazy var? both count variables were declared with var,
var commentCount: Int
var likeCount: Int
and here is the corner case:
if the count will change after the text was created, the string will look like the wrong count just because of lazy var.
I'm not sure your requirements here but, it's looking like a problematic
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.
both commentCount and likeCount both updated to let.
public var seeAllButtonTitle: String? = { | ||
return Localizable.Favorites.seeAllButtonTitle | ||
}() | ||
public var seeAllButtonTapped: ((Int, String) -> Void)? |
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.
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
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.
add public typealias TwoVariablesClosure<A, B> = ((A, B) -> Void)
for this case
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
explicit return remove ^^
// 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 { | ||
/// %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) | ||
} | ||
} | ||
|
||
// 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 comment
The 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 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.
return Localizable.tr("Favorites", "userStats", p1, p2) | ||
} | ||
} | ||
internal enum Recipes { |
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.
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 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.
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 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
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.
This file is automatically generated by Swiftgen. We do not enforce any rules (swiftlint or style guide) for this file.
internal enum Favorites { | ||
/// %d Yorum %d Beğeni | ||
internal static func recipeStats(_ p1: Int, _ p2: Int) -> String { | ||
return Localizable.tr("Favorites", "recipeStats", p1, p2) |
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 than Localizable.tr("Favorites", "recipeStats", p1, p2)
for more readability
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.
This file is automatically generated by Swiftgen. We do not enforce any rules (swiftlint or style guide) for this file.
No description provided.