diff --git a/SampleProject/Podfile.lock b/SampleProject/Podfile.lock index 4284778..a4631dc 100644 --- a/SampleProject/Podfile.lock +++ b/SampleProject/Podfile.lock @@ -74,4 +74,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 240bbaaf597009e1611ff399ef5269ba297f09b1 -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/SampleProject/SampleProject.xcodeproj/project.pbxproj b/SampleProject/SampleProject.xcodeproj/project.pbxproj index b249645..6a1b58a 100644 --- a/SampleProject/SampleProject.xcodeproj/project.pbxproj +++ b/SampleProject/SampleProject.xcodeproj/project.pbxproj @@ -7,13 +7,28 @@ objects = { /* Begin PBXBuildFile section */ + 3D58113728A53EB0003EEADC /* CommentList.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D58113628A53EB0003EEADC /* CommentList.strings */; }; + 3D58113928A53EB7003EEADC /* CommentList.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D58113828A53EB7003EEADC /* CommentList.xcassets */; }; + 3D58113B28A53ECB003EEADC /* CommentListCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D58113A28A53ECB003EEADC /* CommentListCellModel.swift */; }; + 3D58114228A541B4003EEADC /* RecipeDetailComentCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D58114128A541B4003EEADC /* RecipeDetailComentCellModel.swift */; }; + 3D58114428A541ED003EEADC /* RecipeDetail.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D58114328A541ED003EEADC /* RecipeDetail.strings */; }; + 3D58114628A541F5003EEADC /* RecipeDetail.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D58114528A541F5003EEADC /* RecipeDetail.xcassets */; }; + 3D58114828A5436B003EEADC /* RecipeDetailCommentHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D58114728A5436B003EEADC /* RecipeDetailCommentHeaderCell.swift */; }; 3D5DC50A261F52DA002294B7 /* RecipeDetailRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D5DC509261F52DA002294B7 /* RecipeDetailRoute.swift */; }; 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 */; }; @@ -58,8 +73,6 @@ A2176A2726161623008B3C46 /* WalkThroughViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2176A2426161623008B3C46 /* WalkThroughViewController.swift */; }; A2176A2826161623008B3C46 /* WalkThroughViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2176A2526161623008B3C46 /* WalkThroughViewModel.swift */; }; A2176A3026161686008B3C46 /* WalkThroughRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2176A2F26161686008B3C46 /* WalkThroughRoute.swift */; }; - A22C0B8426677A51003A6EFA /* RecipeCellModel+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22C0B8326677A51003A6EFA /* RecipeCellModel+Extension.swift */; }; - A22C0B862667816A003A6EFA /* CategoryCellModel+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22C0B852667816A003A6EFA /* CategoryCellModel+Extension.swift */; }; A22C0B882667970D003A6EFA /* AppDelegate+IQKeyboardManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22C0B872667970D003A6EFA /* AppDelegate+IQKeyboardManager.swift */; }; A2463331266A1F4A00F85CB4 /* ShareSheetRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2463330266A1F4A00F85CB4 /* ShareSheetRoute.swift */; }; A24F29DA26664B5200B7211B /* RecipeDetailHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A24F29D926664B5200B7211B /* RecipeDetailHeaderView.swift */; }; @@ -118,13 +131,28 @@ 1CCE83E92ED6509A80BE4CF4 /* Pods-SampleProject-SampleProjectUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleProject-SampleProjectUITests.release.xcconfig"; path = "Target Support Files/Pods-SampleProject-SampleProjectUITests/Pods-SampleProject-SampleProjectUITests.release.xcconfig"; sourceTree = ""; }; 306B22CF9C53DC0C1D1044A2 /* Pods-SampleProjectTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleProjectTests.debug.xcconfig"; path = "Target Support Files/Pods-SampleProjectTests/Pods-SampleProjectTests.debug.xcconfig"; sourceTree = ""; }; 37C3D1FCD4759056CF947F99 /* Pods_SampleProject_SampleProjectUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SampleProject_SampleProjectUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3D58113628A53EB0003EEADC /* CommentList.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = CommentList.strings; sourceTree = ""; }; + 3D58113828A53EB7003EEADC /* CommentList.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = CommentList.xcassets; sourceTree = ""; }; + 3D58113A28A53ECB003EEADC /* CommentListCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentListCellModel.swift; sourceTree = ""; }; + 3D58114128A541B4003EEADC /* RecipeDetailComentCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipeDetailComentCellModel.swift; sourceTree = ""; }; + 3D58114328A541ED003EEADC /* RecipeDetail.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = RecipeDetail.strings; sourceTree = ""; }; + 3D58114528A541F5003EEADC /* RecipeDetail.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = RecipeDetail.xcassets; sourceTree = ""; }; + 3D58114728A5436B003EEADC /* RecipeDetailCommentHeaderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipeDetailCommentHeaderCell.swift; sourceTree = ""; }; 3D5DC509261F52DA002294B7 /* RecipeDetailRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipeDetailRoute.swift; sourceTree = ""; }; 3D9BC03727BE4BE300DFEFDE /* APIRequestAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIRequestAdapter.swift; sourceTree = ""; }; 3D9BC03827BE4BE300DFEFDE /* APIDataProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIDataProvider.swift; sourceTree = ""; }; - 3DABD56227429CA30035DCA4 /* CommentCellModel+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CommentCellModel+Extensions.swift"; sourceTree = ""; }; + 3DB49F7F289BEBF0003B4769 /* Recipes.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Recipes.strings; sourceTree = ""; }; + 3DB49F81289BEC09003B4769 /* Favorites.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Favorites.xcassets; sourceTree = ""; }; + 3DB49F83289BEC0F003B4769 /* Favorites.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Favorites.strings; sourceTree = ""; }; + 3DB49F85289BF0FF003B4769 /* Localizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Localizable.swift; sourceTree = ""; }; + 3DB49F87289BF114003B4769 /* swiftgen.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = swiftgen.yml; sourceTree = ""; }; 3DD25A4F274248770070567E /* APIRequestInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIRequestInterceptor.swift; sourceTree = ""; }; 3DD25A5327424AC50070567E /* APILogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APILogger.swift; sourceTree = ""; }; 3DD25A5527424AF60070567E /* DataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataProvider.swift; sourceTree = ""; }; + 3DF7B0382898026B0012E4A6 /* Recipes.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Recipes.xcassets; sourceTree = ""; }; + 3DFAF36F28912EF5005D41A8 /* RecipesCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipesCellModel.swift; sourceTree = ""; }; + 3DFAF37628916347005D41A8 /* FavoritesCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesCellModel.swift; sourceTree = ""; }; + 3DFAF37828916467005D41A8 /* FavoritesRecipeCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesRecipeCellModel.swift; sourceTree = ""; }; 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 = ""; }; 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 = ""; }; @@ -184,8 +212,6 @@ A2176A2426161623008B3C46 /* WalkThroughViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalkThroughViewController.swift; sourceTree = ""; }; A2176A2526161623008B3C46 /* WalkThroughViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalkThroughViewModel.swift; sourceTree = ""; }; A2176A2F26161686008B3C46 /* WalkThroughRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalkThroughRoute.swift; sourceTree = ""; }; - A22C0B8326677A51003A6EFA /* RecipeCellModel+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RecipeCellModel+Extension.swift"; sourceTree = ""; }; - A22C0B852667816A003A6EFA /* CategoryCellModel+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CategoryCellModel+Extension.swift"; sourceTree = ""; }; A22C0B872667970D003A6EFA /* AppDelegate+IQKeyboardManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+IQKeyboardManager.swift"; sourceTree = ""; }; A2463330266A1F4A00F85CB4 /* ShareSheetRoute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShareSheetRoute.swift; sourceTree = ""; }; A24F29D926664B5200B7211B /* RecipeDetailHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipeDetailHeaderView.swift; sourceTree = ""; }; @@ -255,6 +281,91 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3D58113128A53E6E003EEADC /* Resources */ = { + isa = PBXGroup; + children = ( + 3D58113628A53EB0003EEADC /* CommentList.strings */, + 3D58113828A53EB7003EEADC /* CommentList.xcassets */, + ); + path = Resources; + sourceTree = ""; + }; + 3D58113228A53E7D003EEADC /* Router */ = { + isa = PBXGroup; + children = ( + A2D7BB572665126600E3F3A2 /* CommentListRoute.swift */, + A2D7BB59266513C900E3F3A2 /* CommentListRouter.swift */, + ); + path = Router; + sourceTree = ""; + }; + 3D58113328A53E83003EEADC /* ViewModel */ = { + isa = PBXGroup; + children = ( + A2D7BB5B266513C900E3F3A2 /* CommentListViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + 3D58113428A53E89003EEADC /* ViewController */ = { + isa = PBXGroup; + children = ( + A2D7BB5A266513C900E3F3A2 /* CommentListViewController.swift */, + ); + path = ViewController; + sourceTree = ""; + }; + 3D58113528A53E8F003EEADC /* Entity */ = { + isa = PBXGroup; + children = ( + 3D58113A28A53ECB003EEADC /* CommentListCellModel.swift */, + ); + path = Entity; + sourceTree = ""; + }; + 3D58113C28A5417D003EEADC /* Entity */ = { + isa = PBXGroup; + children = ( + 3D58114128A541B4003EEADC /* RecipeDetailComentCellModel.swift */, + 3D58114728A5436B003EEADC /* RecipeDetailCommentHeaderCell.swift */, + ); + path = Entity; + sourceTree = ""; + }; + 3D58113D28A54187003EEADC /* ViewController */ = { + isa = PBXGroup; + children = ( + 7AFCDEA5261615A600D5D115 /* RecipeDetailViewController.swift */, + ); + path = ViewController; + sourceTree = ""; + }; + 3D58113E28A5418E003EEADC /* ViewModel */ = { + isa = PBXGroup; + children = ( + 7AFCDEA6261615A600D5D115 /* RecipeDetailViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + 3D58113F28A54193003EEADC /* Router */ = { + isa = PBXGroup; + children = ( + 7AFCDEA4261615A600D5D115 /* RecipeDetailRouter.swift */, + 3D5DC509261F52DA002294B7 /* RecipeDetailRoute.swift */, + ); + path = Router; + sourceTree = ""; + }; + 3D58114028A54198003EEADC /* Resources */ = { + isa = PBXGroup; + children = ( + 3D58114328A541ED003EEADC /* RecipeDetail.strings */, + 3D58114528A541F5003EEADC /* RecipeDetail.xcassets */, + ); + path = Resources; + sourceTree = ""; + }; 3D99B2962656ADCE0002E23E /* Routers */ = { isa = PBXGroup; children = ( @@ -263,6 +374,20 @@ path = Routers; sourceTree = ""; }; + 3DB49F8A289C0C15003B4769 /* CustomViews */ = { + isa = PBXGroup; + children = ( + ); + path = CustomViews; + sourceTree = ""; + }; + 3DB49F8B289C0C4D003B4769 /* CustomViews */ = { + isa = PBXGroup; + children = ( + ); + path = CustomViews; + sourceTree = ""; + }; 3DD25A4E2742486A0070567E /* DataProvider */ = { isa = PBXGroup; children = ( @@ -275,6 +400,90 @@ path = DataProvider; sourceTree = ""; }; + 3DFAF36A28912EB3005D41A8 /* Entity */ = { + isa = PBXGroup; + children = ( + 3DFAF36F28912EF5005D41A8 /* RecipesCellModel.swift */, + ); + path = Entity; + sourceTree = ""; + }; + 3DFAF36B28912EBF005D41A8 /* ViewController */ = { + isa = PBXGroup; + children = ( + B321F655263188A50082484C /* RecipesViewController.swift */, + ); + path = ViewController; + sourceTree = ""; + }; + 3DFAF36C28912EC5005D41A8 /* ViewModel */ = { + isa = PBXGroup; + children = ( + B321F653263188A50082484C /* RecipesViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + 3DFAF36D28912ECA005D41A8 /* Router */ = { + isa = PBXGroup; + children = ( + B321F6742631C8650082484C /* RecipesRouter.swift */, + B321F654263188A50082484C /* RecipesRoute.swift */, + ); + path = Router; + sourceTree = ""; + }; + 3DFAF36E28912EDE005D41A8 /* Resources */ = { + isa = PBXGroup; + children = ( + 3DF7B0382898026B0012E4A6 /* Recipes.xcassets */, + 3DB49F7F289BEBF0003B4769 /* Recipes.strings */, + ); + path = Resources; + sourceTree = ""; + }; + 3DFAF37128916313005D41A8 /* Entity */ = { + isa = PBXGroup; + children = ( + 3DFAF37628916347005D41A8 /* FavoritesCellModel.swift */, + 3DFAF37828916467005D41A8 /* FavoritesRecipeCellModel.swift */, + ); + path = Entity; + sourceTree = ""; + }; + 3DFAF3722891631F005D41A8 /* ViewController */ = { + isa = PBXGroup; + children = ( + 6CFE5374262ED7DC0008FFCD /* FavoritesViewController.swift */, + ); + path = ViewController; + sourceTree = ""; + }; + 3DFAF37328916326005D41A8 /* ViewModel */ = { + isa = PBXGroup; + children = ( + 6CFE5375262ED7DC0008FFCD /* FavoritesViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + 3DFAF3742891632C005D41A8 /* Router */ = { + isa = PBXGroup; + children = ( + 6CFE5373262ED7DC0008FFCD /* FavoritesRouter.swift */, + ); + path = Router; + sourceTree = ""; + }; + 3DFAF37528916332005D41A8 /* Resources */ = { + isa = PBXGroup; + children = ( + 3DB49F81289BEC09003B4769 /* Favorites.xcassets */, + 3DB49F83289BEC0F003B4769 /* Favorites.strings */, + ); + path = Resources; + sourceTree = ""; + }; 5FFC321D261A12EF004D4F15 /* LoginWarning */ = { isa = PBXGroup; children = ( @@ -289,9 +498,12 @@ 6CFE5372262ED7BB0008FFCD /* Favorites */ = { isa = PBXGroup; children = ( - 6CFE5374262ED7DC0008FFCD /* FavoritesViewController.swift */, - 6CFE5375262ED7DC0008FFCD /* FavoritesViewModel.swift */, - 6CFE5373262ED7DC0008FFCD /* FavoritesRouter.swift */, + 3DB49F8A289C0C15003B4769 /* CustomViews */, + 3DFAF37528916332005D41A8 /* Resources */, + 3DFAF3742891632C005D41A8 /* Router */, + 3DFAF37328916326005D41A8 /* ViewModel */, + 3DFAF3722891631F005D41A8 /* ViewController */, + 3DFAF37128916313005D41A8 /* Entity */, ); path = Favorites; sourceTree = ""; @@ -300,6 +512,7 @@ isa = PBXGroup; children = ( 7AFC72A52551FA1A00B30789 /* Assets.xcassets */, + 3DB49F85289BF0FF003B4769 /* Localizable.swift */, ); path = Resources; sourceTree = ""; @@ -404,6 +617,7 @@ 7AFC72902551FA1800B30789 = { isa = PBXGroup; children = ( + 3DB49F87289BF114003B4769 /* swiftgen.yml */, 7A6AED8A25A756F900BB1457 /* .swiftlint.yml */, 7AFC729B2551FA1800B30789 /* SampleProject */, 7AFC72B22551FA1A00B30789 /* SampleProjectTests */, @@ -434,7 +648,6 @@ 840EB5A22645894A0019C101 /* Delegates */, 7A73C91225CC385900322233 /* Resources */, 7AC7AC2C25CD48D700EA44C4 /* Constants */, - A22C0B8226677A0C003A6EFA /* UIComponents */, 7AFC72DB2551FBF800B30789 /* Configurations */, 7A980AE92553170600494520 /* Routing */, 7A980AB02553166D00494520 /* Scenes */, @@ -509,10 +722,11 @@ isa = PBXGroup; children = ( A24F29DB26664B6800B7211B /* SubViews */, - 7AFCDEA5261615A600D5D115 /* RecipeDetailViewController.swift */, - 7AFCDEA6261615A600D5D115 /* RecipeDetailViewModel.swift */, - 7AFCDEA4261615A600D5D115 /* RecipeDetailRouter.swift */, - 3D5DC509261F52DA002294B7 /* RecipeDetailRoute.swift */, + 3D58114028A54198003EEADC /* Resources */, + 3D58113F28A54193003EEADC /* Router */, + 3D58113E28A5418E003EEADC /* ViewModel */, + 3D58113D28A54187003EEADC /* ViewController */, + 3D58113C28A5417D003EEADC /* Entity */, ); path = RecipeDetail; sourceTree = ""; @@ -555,16 +769,6 @@ path = WalkThrough; sourceTree = ""; }; - A22C0B8226677A0C003A6EFA /* UIComponents */ = { - isa = PBXGroup; - children = ( - A22C0B8326677A51003A6EFA /* RecipeCellModel+Extension.swift */, - A22C0B852667816A003A6EFA /* CategoryCellModel+Extension.swift */, - 3DABD56227429CA30035DCA4 /* CommentCellModel+Extensions.swift */, - ); - path = UIComponents; - sourceTree = ""; - }; A24F29DB26664B6800B7211B /* SubViews */ = { isa = PBXGroup; children = ( @@ -624,10 +828,11 @@ A2D7BB502665121C00E3F3A2 /* CommentList */ = { isa = PBXGroup; children = ( - A2D7BB5A266513C900E3F3A2 /* CommentListViewController.swift */, - A2D7BB5B266513C900E3F3A2 /* CommentListViewModel.swift */, - A2D7BB59266513C900E3F3A2 /* CommentListRouter.swift */, - A2D7BB572665126600E3F3A2 /* CommentListRoute.swift */, + 3D58113528A53E8F003EEADC /* Entity */, + 3D58113428A53E89003EEADC /* ViewController */, + 3D58113328A53E83003EEADC /* ViewModel */, + 3D58113228A53E7D003EEADC /* Router */, + 3D58113128A53E6E003EEADC /* Resources */, ); path = CommentList; sourceTree = ""; @@ -635,10 +840,12 @@ B321F651263188A50082484C /* Recipes */ = { isa = PBXGroup; children = ( - B321F655263188A50082484C /* RecipesViewController.swift */, - B321F653263188A50082484C /* RecipesViewModel.swift */, - B321F6742631C8650082484C /* RecipesRouter.swift */, - B321F654263188A50082484C /* RecipesRoute.swift */, + 3DB49F8B289C0C4D003B4769 /* CustomViews */, + 3DFAF36E28912EDE005D41A8 /* Resources */, + 3DFAF36D28912ECA005D41A8 /* Router */, + 3DFAF36C28912EC5005D41A8 /* ViewModel */, + 3DFAF36B28912EBF005D41A8 /* ViewController */, + 3DFAF36A28912EB3005D41A8 /* Entity */, ); path = Recipes; sourceTree = ""; @@ -712,11 +919,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 = ( ); @@ -815,6 +1023,15 @@ buildActionMask = 2147483647; files = ( 7AFC72A92551FA1A00B30789 /* LaunchScreen.storyboard in Resources */, + 3DB49F88289BF114003B4769 /* swiftgen.yml in Resources */, + 3D58114628A541F5003EEADC /* RecipeDetail.xcassets in Resources */, + 3D58113928A53EB7003EEADC /* CommentList.xcassets in Resources */, + 3D58113728A53EB0003EEADC /* CommentList.strings in Resources */, + 3DB49F82289BEC09003B4769 /* Favorites.xcassets in Resources */, + 3D58114428A541ED003EEADC /* RecipeDetail.strings in Resources */, + 3DB49F84289BEC0F003B4769 /* Favorites.strings in Resources */, + 3DF7B0392898026B0012E4A6 /* Recipes.xcassets in Resources */, + 3DB49F80289BEBF0003B4769 /* Recipes.strings in Resources */, 7AFC72A62551FA1A00B30789 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -880,6 +1097,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; @@ -968,6 +1203,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 */, @@ -975,16 +1211,16 @@ A2D7BB492664FC3C00E3F3A2 /* PasswordResetRouter.swift in Sources */, 84AB45DB2629791B007A41A7 /* ScreenSize.swift in Sources */, 84BBEF262632CD6D00F33F04 /* AppDelegate+SKPhotoBrowser.swift in Sources */, - A22C0B8426677A51003A6EFA /* RecipeCellModel+Extension.swift in Sources */, A2D7BB5C266513C900E3F3A2 /* CommentListRouter.swift in Sources */, 7A980AE5255316BF00494520 /* MainNavigationController.swift in Sources */, - A22C0B862667816A003A6EFA /* CategoryCellModel+Extension.swift in Sources */, A24F29DD26667C4100B7211B /* UnfollowAlertViewRoute.swift in Sources */, + 3D58113B28A53ECB003EEADC /* CommentListCellModel.swift in Sources */, A2F53D6F2668E7B7007E89BA /* NotificationNames.swift in Sources */, A2176A3026161686008B3C46 /* WalkThroughRoute.swift in Sources */, 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 */, @@ -992,12 +1228,14 @@ 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 */, A24F29DA26664B5200B7211B /* RecipeDetailHeaderView.swift in Sources */, A2D7BB6B266524F600E3F3A2 /* CommentEditRoute.swift in Sources */, B321F6752631C8650082484C /* RecipesRouter.swift in Sources */, + 3D58114828A5436B003EEADC /* RecipeDetailCommentHeaderCell.swift in Sources */, A2D7BB5E266513C900E3F3A2 /* CommentListViewModel.swift in Sources */, 5FFC3224261A1328004D4F15 /* LoginWarningPopupViewModel.swift in Sources */, A2D7BB4B2664FC3C00E3F3A2 /* PasswordResetViewModel.swift in Sources */, @@ -1015,7 +1253,6 @@ A2D7BB4D2664FC4900E3F3A2 /* PasswordResetRoute.swift in Sources */, 7A980AEF2553171A00494520 /* PlaceOnWindowTransition.swift in Sources */, A2D7BB632665184500E3F3A2 /* CommentEditDeleteAlertViewRoute.swift in Sources */, - 3DABD56327429CA30035DCA4 /* CommentCellModel+Extensions.swift in Sources */, 7A980AE4255316BF00494520 /* BaseViewController.swift in Sources */, 7A980AF82553173F00494520 /* Animator.swift in Sources */, A2D7BB69266524E200E3F3A2 /* CommentEditViewModel.swift in Sources */, @@ -1028,6 +1265,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 */, @@ -1038,6 +1276,7 @@ 3DD25A5427424AC50070567E /* APILogger.swift in Sources */, 5FFC3225261A1328004D4F15 /* LoginWarningPopupViewController.swift in Sources */, FBA13ECD2616137A001E19B4 /* RegisterRoute.swift in Sources */, + 3D58114228A541B4003EEADC /* RecipeDetailComentCellModel.swift in Sources */, 7A716CDC260B4B83008B91B7 /* TransparentNavigationController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/SampleProject/SampleProject/Delegates/PhotoBrowserDelegate.swift b/SampleProject/SampleProject/Delegates/PhotoBrowserDelegate.swift index f387140..89a3e86 100644 --- a/SampleProject/SampleProject/Delegates/PhotoBrowserDelegate.swift +++ b/SampleProject/SampleProject/Delegates/PhotoBrowserDelegate.swift @@ -10,12 +10,10 @@ import SKPhotoBrowser final class PhotoBrowserDelegate: SKPhotoBrowserDelegate { - var willDismissAtPage: IntClosure? - - func willDismissAtPageIndex(_ index: Int) { - if let didDismiss = willDismissAtPage { - didDismiss(index) - } + var didScrollToRow: IntClosure? + + func didScrollToIndex(_ browser: SKPhotoBrowser, index: Int) { + didScrollToRow?(index) } } diff --git a/SampleProject/SampleProject/Resources/Localizable.swift b/SampleProject/SampleProject/Resources/Localizable.swift new file mode 100644 index 0000000..d2c5822 --- /dev/null +++ b/SampleProject/SampleProject/Resources/Localizable.swift @@ -0,0 +1,70 @@ +// 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 CommentList { + /// %d Tarif %d Takipçi + internal static func userStats(_ p1: Int, _ p2: Int) -> String { + return Localizable.tr("CommentList", "userStats", p1, p2) + } + } + 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 RecipeDetail { + /// %d Tarif %d Takipçi + internal static func userStats(_ p1: Int, _ p2: Int) -> String { + return Localizable.tr("RecipeDetail", "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 diff --git a/SampleProject/SampleProject/Scenes/Auth/PasswordReset/PasswordResetViewModel.swift b/SampleProject/SampleProject/Scenes/Auth/PasswordReset/PasswordResetViewModel.swift index ab07b83..8e4843c 100644 --- a/SampleProject/SampleProject/Scenes/Auth/PasswordReset/PasswordResetViewModel.swift +++ b/SampleProject/SampleProject/Scenes/Auth/PasswordReset/PasswordResetViewModel.swift @@ -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) diff --git a/SampleProject/SampleProject/Scenes/Comment/CommentEdit/CommentEditViewModel.swift b/SampleProject/SampleProject/Scenes/Comment/CommentEdit/CommentEditViewModel.swift index 36f58d8..e771433 100644 --- a/SampleProject/SampleProject/Scenes/Comment/CommentEdit/CommentEditViewModel.swift +++ b/SampleProject/SampleProject/Scenes/Comment/CommentEdit/CommentEditViewModel.swift @@ -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): diff --git a/SampleProject/SampleProject/Scenes/Comment/CommentList/Entity/CommentListCellModel.swift b/SampleProject/SampleProject/Scenes/Comment/CommentList/Entity/CommentListCellModel.swift new file mode 100644 index 0000000..39b5d6a --- /dev/null +++ b/SampleProject/SampleProject/Scenes/Comment/CommentList/Entity/CommentListCellModel.swift @@ -0,0 +1,42 @@ +// +// CommentListCellModel.swift +// SampleProject +// +// Created by Mehmet Salih Aslan on 11.08.2022. +// Copyright © 2022 Mobillium. All rights reserved. +// + +import MobilliumUserDefaults + +class CommentListCellModel: CommentCellProtocol { + + let commentId: Int + let userId: Int + var imageUrl: String? + var username: String? + var userFollowerCount: Int + var userRecipeCount: Int + var userRecipeAndFollowerCountText: String? { + return Localizable.CommentList.userStats(userRecipeCount, userFollowerCount) + } + var timeDifferenceText: String? + var commentText: String? + var isOwner: Bool + var moreButtonTapped: VoidClosure? + var commentTextDidChanged: VoidClosure? + + public init(comment: RecipeComment) { + self.userId = comment.user.id + self.imageUrl = comment.user.image?.url + self.username = comment.user.username + self.userFollowerCount = comment.user.followedCount + self.userRecipeCount = comment.user.recipeCount + + let isOwner = comment.user.id == DefaultsKey.userId.value + self.commentId = comment.id + self.timeDifferenceText = comment.timeDifference + self.commentText = comment.text + self.isOwner = isOwner + } + +} diff --git a/SampleProject/SampleProject/Scenes/Comment/CommentList/Resources/CommentList.strings b/SampleProject/SampleProject/Scenes/Comment/CommentList/Resources/CommentList.strings new file mode 100644 index 0000000..0de7e50 --- /dev/null +++ b/SampleProject/SampleProject/Scenes/Comment/CommentList/Resources/CommentList.strings @@ -0,0 +1,9 @@ +/* + CommentList.strings + SampleProject + + Created by Mehmet Salih Aslan on 11.08.2022. + Copyright © 2022 Mobillium. All rights reserved. +*/ + +"userStats" = "%d Tarif %d Takipçi"; diff --git a/SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListRoute.swift b/SampleProject/SampleProject/Scenes/Comment/CommentList/Router/CommentListRoute.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListRoute.swift rename to SampleProject/SampleProject/Scenes/Comment/CommentList/Router/CommentListRoute.swift diff --git a/SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListRouter.swift b/SampleProject/SampleProject/Scenes/Comment/CommentList/Router/CommentListRouter.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListRouter.swift rename to SampleProject/SampleProject/Scenes/Comment/CommentList/Router/CommentListRouter.swift diff --git a/SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListViewController.swift b/SampleProject/SampleProject/Scenes/Comment/CommentList/ViewController/CommentListViewController.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListViewController.swift rename to SampleProject/SampleProject/Scenes/Comment/CommentList/ViewController/CommentListViewController.swift diff --git a/SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListViewModel.swift b/SampleProject/SampleProject/Scenes/Comment/CommentList/ViewModel/CommentListViewModel.swift similarity index 94% rename from SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListViewModel.swift rename to SampleProject/SampleProject/Scenes/Comment/CommentList/ViewModel/CommentListViewModel.swift index 24d1064..5b55773 100644 --- a/SampleProject/SampleProject/Scenes/Comment/CommentList/CommentListViewModel.swift +++ b/SampleProject/SampleProject/Scenes/Comment/CommentList/ViewModel/CommentListViewModel.swift @@ -13,7 +13,7 @@ protocol CommentListViewDataSource { var title: String { get } func numberOfItemsAt(section: Int) -> Int - func cellItemAt(indexPath: IndexPath) -> CommentCellProtocol + func cellItemAt(indexPath: IndexPath) -> CommentListCellModel } protocol CommentListViewEventSource { @@ -52,11 +52,11 @@ final class CommentListViewModel: BaseViewModel, CommentListV return cellItems.count } - func cellItemAt(indexPath: IndexPath) -> CommentCellProtocol { + func cellItemAt(indexPath: IndexPath) -> CommentListCellModel { return cellItems[indexPath.row] } - var cellItems: [CommentCellProtocol] = [] + var cellItems: [CommentListCellModel] = [] } // MARK: - Actions @@ -101,7 +101,6 @@ extension CommentListViewModel { } // MARK: - Network -// swiftlint:disable line_length extension CommentListViewModel { func fetchComments() { @@ -117,7 +116,7 @@ extension CommentListViewModel { if self.page == 1 { self.cellItems.removeAll() } - let cellItems = response.data.map({ CommentCellModel(comment: $0) }) + let cellItems = response.data.map({ CommentListCellModel(comment: $0) }) self.cellItems.append(contentsOf: cellItems) self.isPagingEnabled = response.pagination.currentPage < response.pagination.lastPage if self.isPagingEnabled { self.page += 1 } @@ -127,7 +126,6 @@ extension CommentListViewModel { } } } - // swiftlint:enable line_length private func deleteCommentRequest(indexPath: IndexPath) { let commentId = cellItems[indexPath.row].commentId diff --git a/SampleProject/SampleProject/Scenes/Favorites/Entity/FavoritesCellModel.swift b/SampleProject/SampleProject/Scenes/Favorites/Entity/FavoritesCellModel.swift new file mode 100644 index 0000000..9f13900 --- /dev/null +++ b/SampleProject/SampleProject/Scenes/Favorites/Entity/FavoritesCellModel.swift @@ -0,0 +1,27 @@ +// +// 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 let categoryId: Int + public let categoryImageURL: String? + public let categoryName: String? + public let seeAllButtonTitle: String? = Localizable.Favorites.seeAllButtonTitle + public var seeAllButtonTapped: TwoVariablesClosure? + public let 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 + } +} diff --git a/SampleProject/SampleProject/Scenes/Favorites/Entity/FavoritesRecipeCellModel.swift b/SampleProject/SampleProject/Scenes/Favorites/Entity/FavoritesRecipeCellModel.swift new file mode 100644 index 0000000..8a95359 --- /dev/null +++ b/SampleProject/SampleProject/Scenes/Favorites/Entity/FavoritesRecipeCellModel.swift @@ -0,0 +1,38 @@ +// +// FavoritesRecipeCellModel.swift +// SampleProject +// +// Created by Mehmet Salih Aslan on 27.07.2022. +// Copyright © 2022 Mobillium. All rights reserved. +// + +class FavoritesRecipeCellModel: RecipeSmallCellProtocol { + + let recipeId: Int + let userId: Int + let userImageUrl: String? + let username: String? + let recipeTitle: String? + let categoryName: String? + let recipeImageUrl: String? + let commentCount: Int + let likeCount: Int + lazy var recipeCommnetAndLikeCountText: String? = { + return Localizable.Recipes.recipeStats(commentCount, likeCount) + }() + let isEditorChoice: Bool + var followButtonTapped: VoidClosure? + + init(recipe: Recipe) { + self.recipeId = recipe.id + self.userId = recipe.user.id + self.userImageUrl = recipe.user.image?.url + self.username = recipe.user.username + self.recipeTitle = recipe.title + self.categoryName = recipe.category.name + self.recipeImageUrl = recipe.images.first?.url + self.commentCount = recipe.commentCount + self.likeCount = recipe.likeCount + self.isEditorChoice = recipe.isEditorChoice + } +} diff --git a/SampleProject/SampleProject/Scenes/Favorites/Resources/Favorites.strings b/SampleProject/SampleProject/Scenes/Favorites/Resources/Favorites.strings new file mode 100644 index 0000000..0e2726e --- /dev/null +++ b/SampleProject/SampleProject/Scenes/Favorites/Resources/Favorites.strings @@ -0,0 +1,11 @@ +/* + Favorites.strings + SampleProject + + Created by Mehmet Salih Aslan on 4.08.2022. + Copyright © 2022 Mobillium. All rights reserved. +*/ + +"userStats" = "%d Tarif %d Takipçi"; +"recipeStats" = "%d Yorum %d Beğeni"; +"seeAllButtonTitle" = "TÜMÜNÜ GÖR"; diff --git a/SampleProject/SampleProject/Scenes/Favorites/FavoritesRouter.swift b/SampleProject/SampleProject/Scenes/Favorites/Router/FavoritesRouter.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Favorites/FavoritesRouter.swift rename to SampleProject/SampleProject/Scenes/Favorites/Router/FavoritesRouter.swift diff --git a/SampleProject/SampleProject/Scenes/Favorites/FavoritesViewController.swift b/SampleProject/SampleProject/Scenes/Favorites/ViewController/FavoritesViewController.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Favorites/FavoritesViewController.swift rename to SampleProject/SampleProject/Scenes/Favorites/ViewController/FavoritesViewController.swift diff --git a/SampleProject/SampleProject/Scenes/Favorites/FavoritesViewModel.swift b/SampleProject/SampleProject/Scenes/Favorites/ViewModel/FavoritesViewModel.swift similarity index 93% rename from SampleProject/SampleProject/Scenes/Favorites/FavoritesViewModel.swift rename to SampleProject/SampleProject/Scenes/Favorites/ViewModel/FavoritesViewModel.swift index 1c79bb7..6b50457 100644 --- a/SampleProject/SampleProject/Scenes/Favorites/FavoritesViewModel.swift +++ b/SampleProject/SampleProject/Scenes/Favorites/ViewModel/FavoritesViewModel.swift @@ -32,7 +32,7 @@ final class FavoritesViewModel: BaseViewModel, FavoritesViewPro private var page = 1 var isRequestEnabled = false var isPagingEnabled = false - var cellItems: [CategoryWithRecipesCellModel] = [] + var cellItems: [FavoritesCellModel] = [] var didSuccessFetchCategories: VoidClosure? var didSuccesLogout: VoidClosure? @@ -75,12 +75,12 @@ extension FavoritesViewModel { self.isRequestEnabled = true switch result { case .success(let response): - let cellItems = response.data.map({ CategoryWithRecipesCellModel(category: $0) }) + let cellItems = response.data.map({ FavoritesCellModel(category: $0) }) self.cellItems.append(contentsOf: cellItems) self.page += 1 self.isPagingEnabled = response.pagination.currentPage < response.pagination.lastPage self.didSuccessFetchCategories?() - case .failure(_ ): + case .failure: if self.page == 1 { self.showWarningToast?(L10n.Error.refreshFromTop) } } } @@ -93,7 +93,7 @@ extension FavoritesViewModel { guard let self = self else { return } self.hideLoading?() switch result { - case .success(_ ): + case .success: self.didSuccesLogout?() case .failure(let error): self.showWarningToast?(error.localizedDescription) diff --git a/SampleProject/SampleProject/Scenes/Home/HomeViewModel.swift b/SampleProject/SampleProject/Scenes/Home/HomeViewModel.swift index 3007a62..d8106fb 100644 --- a/SampleProject/SampleProject/Scenes/Home/HomeViewModel.swift +++ b/SampleProject/SampleProject/Scenes/Home/HomeViewModel.swift @@ -48,9 +48,8 @@ extension HomeViewModel { guard let self = self else { return } self.hideLoading?() switch result { - case .success(let response): + case .success: self.didSuccesLogout?() - print(response.message) case .failure(let error): self.showWarningToast?(error.localizedDescription) } diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/Entity/RecipeDetailComentCellModel.swift b/SampleProject/SampleProject/Scenes/RecipeDetail/Entity/RecipeDetailComentCellModel.swift new file mode 100644 index 0000000..80920d2 --- /dev/null +++ b/SampleProject/SampleProject/Scenes/RecipeDetail/Entity/RecipeDetailComentCellModel.swift @@ -0,0 +1,41 @@ +// +// RecipeDetailComentCellModel.swift +// SampleProject +// +// Created by Mehmet Salih Aslan on 11.08.2022. +// Copyright © 2022 Mobillium. All rights reserved. +// + +import MobilliumUserDefaults + +class RecipeDetailComentCellModel: CommentCellProtocol { + + let commentId: Int + let userId: Int + var imageUrl: String? + var username: String? + var userFollowerCount: Int + var userRecipeCount: Int + var userRecipeAndFollowerCountText: String? { + return Localizable.RecipeDetail.userStats(userRecipeCount, userFollowerCount) + } + var timeDifferenceText: String? + var commentText: String? + var isOwner: Bool + var moreButtonTapped: VoidClosure? + var commentTextDidChanged: VoidClosure? + + public init(comment: RecipeComment) { + self.userId = comment.user.id + self.imageUrl = comment.user.image?.url + self.username = comment.user.username + self.userFollowerCount = comment.user.followedCount + self.userRecipeCount = comment.user.recipeCount + + let isOwner = comment.user.id == DefaultsKey.userId.value + self.commentId = comment.id + self.timeDifferenceText = comment.timeDifference + self.commentText = comment.text + self.isOwner = isOwner + } +} diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/Entity/RecipeDetailCommentHeaderCell.swift b/SampleProject/SampleProject/Scenes/RecipeDetail/Entity/RecipeDetailCommentHeaderCell.swift new file mode 100644 index 0000000..b0e852f --- /dev/null +++ b/SampleProject/SampleProject/Scenes/RecipeDetail/Entity/RecipeDetailCommentHeaderCell.swift @@ -0,0 +1,20 @@ +// +// RecipeDetailCommentHeaderCell.swift +// SampleProject +// +// Created by Mehmet Salih Aslan on 11.08.2022. +// Copyright © 2022 Mobillium. All rights reserved. +// + + final class RecipeDetailCommentHeaderCell: RecipeHeaderCellProtocol { + var imageUrl: String + var isEditorChoice: Bool + + init?(imageUrl: String?, isEditorChoice: Bool) { + guard let imageUrl = imageUrl else { + return nil + } + self.imageUrl = imageUrl + self.isEditorChoice = isEditorChoice + } +} diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/Resources/RecipeDetail.strings b/SampleProject/SampleProject/Scenes/RecipeDetail/Resources/RecipeDetail.strings new file mode 100644 index 0000000..c12879c --- /dev/null +++ b/SampleProject/SampleProject/Scenes/RecipeDetail/Resources/RecipeDetail.strings @@ -0,0 +1,9 @@ +/* + RecipeDetail.strings + SampleProject + + Created by Mehmet Salih Aslan on 11.08.2022. + Copyright © 2022 Mobillium. All rights reserved. +*/ + +"userStats" = "%d Tarif %d Takipçi"; diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailRoute.swift b/SampleProject/SampleProject/Scenes/RecipeDetail/Router/RecipeDetailRoute.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailRoute.swift rename to SampleProject/SampleProject/Scenes/RecipeDetail/Router/RecipeDetailRoute.swift diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailRouter.swift b/SampleProject/SampleProject/Scenes/RecipeDetail/Router/RecipeDetailRouter.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailRouter.swift rename to SampleProject/SampleProject/Scenes/RecipeDetail/Router/RecipeDetailRouter.swift diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/SubViews/RecipeDetailHeaderView.swift b/SampleProject/SampleProject/Scenes/RecipeDetail/SubViews/RecipeDetailHeaderView.swift index 0bb3b03..322e3a9 100644 --- a/SampleProject/SampleProject/Scenes/RecipeDetail/SubViews/RecipeDetailHeaderView.swift +++ b/SampleProject/SampleProject/Scenes/RecipeDetail/SubViews/RecipeDetailHeaderView.swift @@ -26,7 +26,7 @@ final class RecipeDetailHeaderView: UIView { var photoBrowserDelegate: PhotoBrowserDelegate? // swiftlint:enable weak_delegate - var recipeHeaderData: [RecipeHeaderCellProtocol] = [] { + var recipeHeaderData: [RecipeDetailCommentHeaderCell] = [] { didSet { collectionView.reloadData() pageControl.numberOfPages = recipeHeaderData.count @@ -67,7 +67,7 @@ extension RecipeDetailHeaderView { private func configurePhotoBrowserDelegate() { photoBrowserDelegate = PhotoBrowserDelegate() - photoBrowserDelegate?.willDismissAtPage = { [weak self] (index) in + photoBrowserDelegate?.didScrollToRow = { [weak self] (index) in guard let self = self else { return } let indexPath = IndexPath(item: index, section: 0) self.collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true) diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailViewController.swift b/SampleProject/SampleProject/Scenes/RecipeDetail/ViewController/RecipeDetailViewController.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailViewController.swift rename to SampleProject/SampleProject/Scenes/RecipeDetail/ViewController/RecipeDetailViewController.swift diff --git a/SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailViewModel.swift b/SampleProject/SampleProject/Scenes/RecipeDetail/ViewModel/RecipeDetailViewModel.swift similarity index 88% rename from SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailViewModel.swift rename to SampleProject/SampleProject/Scenes/RecipeDetail/ViewModel/RecipeDetailViewModel.swift index 6bf1381..9c13628 100644 --- a/SampleProject/SampleProject/Scenes/RecipeDetail/RecipeDetailViewModel.swift +++ b/SampleProject/SampleProject/Scenes/RecipeDetail/ViewModel/RecipeDetailViewModel.swift @@ -29,7 +29,7 @@ protocol RecipeDetailViewDataSource { var isFollowing: Bool { get } func numberOfItemsAt(section: Int) -> Int - func cellItemAt(indexPath: IndexPath) -> CommentCellProtocol + func cellItemAt(indexPath: IndexPath) -> RecipeDetailComentCellModel } protocol RecipeDetailViewEventSource { @@ -82,7 +82,7 @@ final class RecipeDetailViewModel: BaseViewModel, RecipeDeta let keychain = KeychainSwift() - var recipeHeaderCellItems: [RecipeHeaderCellProtocol] = [] + var recipeHeaderCellItems: [RecipeDetailCommentHeaderCell] = [] init(recipeId: Int, router: RecipeDetailRouter) { self.recipeId = recipeId @@ -93,11 +93,11 @@ final class RecipeDetailViewModel: BaseViewModel, RecipeDeta return cellItems.count } - func cellItemAt(indexPath: IndexPath) -> CommentCellProtocol { + func cellItemAt(indexPath: IndexPath) -> RecipeDetailComentCellModel { return cellItems[indexPath.row] } - var cellItems: [CommentCellProtocol] = [] + var cellItems: [RecipeDetailComentCellModel] = [] } @@ -156,7 +156,6 @@ extension RecipeDetailViewModel { } // MARK: - Network -// swiftlint:disable line_length extension RecipeDetailViewModel { func getRecipeComment() { @@ -165,10 +164,10 @@ extension RecipeDetailViewModel { switch result { case .success(let response): guard let self = self else { return } - let cellItems = response.data.map({ CommentCellModel(comment: $0) }) + let cellItems = response.data.map({ RecipeDetailComentCellModel(comment: $0) }) self.cellItems = cellItems self.reloadCommentData?() - case .failure(_ ): + case .failure: self?.reloadCommentData?() } } @@ -196,7 +195,7 @@ extension RecipeDetailViewModel { recipeCount = recipeDetail.user.recipeCount categoryName = recipeDetail.category.name timeDifferenceText = recipeDetail.timeDifference - recipeAndFollowerCountText = "\(recipeCount ?? 0) \(L10n.General.recipe) \(userFollowedCount ?? 0) \(L10n.General.follower)" + recipeAndFollowerCountText = Localizable.RecipeDetail.userStats(recipeCount ?? 0, userFollowedCount ?? 0) ingredients = recipeDetail.ingredients numberOfPeople = recipeDetail.numberOfPerson.text steps = recipeDetail.instructions @@ -206,9 +205,7 @@ extension RecipeDetailViewModel { isLiked = recipeDetail.isLiked isFollowing = recipeDetail.user.isFollowing followedId = recipeDetail.user.id - recipeDetail.images.forEach({ image in - recipeHeaderCellItems.append(RecipeHeaderCellModel(imageUrl: image.url ?? "", isEditorChoice: recipeDetail.isEditorChoice)) - }) + recipeHeaderCellItems = recipeDetail.images.compactMap({ RecipeDetailCommentHeaderCell(imageUrl: $0.url, isEditorChoice: recipeDetail.isEditorChoice) }) } private func recipeLikeRequest() { @@ -223,8 +220,8 @@ extension RecipeDetailViewModel { dataProvider.request(for: request) { [weak self] (result) in guard let self = self else { return } switch result { - case .success(let response): - print(response.message) + case .success: + break case .failure(let error): print(error.localizedDescription) self.toggleIsLiked?() @@ -239,8 +236,8 @@ extension RecipeDetailViewModel { dataProvider.request(for: request) { [weak self] (result) in guard let self = self else { return } switch result { - case .success(let response): - print(response.message) + case .success: + break case .failure(let error): print(error.localizedDescription) self.toggleIsFollowing?() @@ -248,4 +245,3 @@ extension RecipeDetailViewModel { } } } -// swiftlint:enable line_length diff --git a/SampleProject/SampleProject/Scenes/Recipes/Entity/RecipesCellModel.swift b/SampleProject/SampleProject/Scenes/Recipes/Entity/RecipesCellModel.swift new file mode 100644 index 0000000..2ed1b49 --- /dev/null +++ b/SampleProject/SampleProject/Scenes/Recipes/Entity/RecipesCellModel.swift @@ -0,0 +1,49 @@ +// +// RecipesCellModel.swift +// SampleProject +// +// Created by Mehmet Salih Aslan on 27.07.2022. +// Copyright © 2022 Mobillium. All rights reserved. +// + +import Foundation + +class RecipesCellModel: RecipeCellProtocol { + + let recipeId: Int + let userId: Int + let userImageUrl: String? + let username: String? + let userFollowerCount: Int + let userRecipeCount: Int + let recipeTitle: String? + let categoryName: String? + let recipeImageUrl: String? + var commentCount: Int + var likeCount: Int + let isEditorChoice: Bool + var followButtonTapped: VoidClosure? + + lazy var userRecipeAndFollowerCountText: String? = { + return Localizable.Recipes.userStats(userRecipeCount, userFollowerCount) + }() + + lazy var recipeCommnetAndLikeCountText: String? = { + return Localizable.Recipes.recipeStats(commentCount, likeCount) + }() + + init(recipe: Recipe) { + self.recipeId = recipe.id + self.userId = recipe.user.id + self.userImageUrl = recipe.user.image?.url + self.username = recipe.user.username + self.userRecipeCount = recipe.user.recipeCount + self.userFollowerCount = recipe.user.followingCount + self.recipeTitle = recipe.title + self.categoryName = recipe.category.name + self.recipeImageUrl = recipe.images.first?.url + self.commentCount = recipe.commentCount + self.likeCount = recipe.likeCount + self.isEditorChoice = recipe.isEditorChoice + } +} diff --git a/SampleProject/SampleProject/Scenes/Recipes/Resources/Recipes.strings b/SampleProject/SampleProject/Scenes/Recipes/Resources/Recipes.strings new file mode 100644 index 0000000..dbe0615 --- /dev/null +++ b/SampleProject/SampleProject/Scenes/Recipes/Resources/Recipes.strings @@ -0,0 +1,10 @@ +/* + Recipes.strings + SampleProject + + Created by Mehmet Salih Aslan on 4.08.2022. + Copyright © 2022 Mobillium. All rights reserved. +*/ + +"userStats" = "%d Tarif %d Takipçi"; +"recipeStats" = "%d Yorum %d Beğeni"; diff --git a/SampleProject/SampleProject/Scenes/Recipes/RecipesRoute.swift b/SampleProject/SampleProject/Scenes/Recipes/Router/RecipesRoute.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Recipes/RecipesRoute.swift rename to SampleProject/SampleProject/Scenes/Recipes/Router/RecipesRoute.swift diff --git a/SampleProject/SampleProject/Scenes/Recipes/RecipesRouter.swift b/SampleProject/SampleProject/Scenes/Recipes/Router/RecipesRouter.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Recipes/RecipesRouter.swift rename to SampleProject/SampleProject/Scenes/Recipes/Router/RecipesRouter.swift diff --git a/SampleProject/SampleProject/Scenes/Recipes/RecipesViewController.swift b/SampleProject/SampleProject/Scenes/Recipes/ViewController/RecipesViewController.swift similarity index 100% rename from SampleProject/SampleProject/Scenes/Recipes/RecipesViewController.swift rename to SampleProject/SampleProject/Scenes/Recipes/ViewController/RecipesViewController.swift diff --git a/SampleProject/SampleProject/Scenes/Recipes/RecipesViewModel.swift b/SampleProject/SampleProject/Scenes/Recipes/ViewModel/RecipesViewModel.swift similarity index 95% rename from SampleProject/SampleProject/Scenes/Recipes/RecipesViewModel.swift rename to SampleProject/SampleProject/Scenes/Recipes/ViewModel/RecipesViewModel.swift index 0e97266..af95929 100644 --- a/SampleProject/SampleProject/Scenes/Recipes/RecipesViewModel.swift +++ b/SampleProject/SampleProject/Scenes/Recipes/ViewModel/RecipesViewModel.swift @@ -24,7 +24,7 @@ protocol RecipesViewProtocol: RecipesViewDataSource, RecipesViewEventSource { func fetchMorePages() } -final class RecipesViewModel: BaseViewModel, RecipesViewProtocol { +final class RecipesViewModel: BaseViewModel, RecipesViewProtocol { enum RecipesListingType { case editorChoiceRecipes @@ -36,7 +36,7 @@ final class RecipesViewModel: BaseViewModel, RecipesViewProtocol var isPagingEnabled = false var page = 1 - var cellItems: [RecipeCellProtocol] = [] + var cellItems: [RecipesCellModel] = [] var didSuccessFetchRecipes: VoidClosure? private var recipesListingType: RecipesListingType @@ -87,7 +87,7 @@ extension RecipesViewModel { self.isRequestEnabled = true switch result { case .success(let response): - let cellItems = response.data.map({ RecipeCellModel(recipe: $0) }) + let cellItems = response.data.map({ RecipesCellModel(recipe: $0) }) self.cellItems.append(contentsOf: cellItems) self.page += 1 self.isPagingEnabled = response.pagination.currentPage < response.pagination.lastPage diff --git a/SampleProject/SampleProject/UIComponents/CategoryCellModel+Extension.swift b/SampleProject/SampleProject/UIComponents/CategoryCellModel+Extension.swift deleted file mode 100644 index 12b7d58..0000000 --- a/SampleProject/SampleProject/UIComponents/CategoryCellModel+Extension.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// CategoryCellViiewModel+Extension.swift -// Fodamy -// -// Created by Catalina on 12.01.2021. -// - -import Foundation - -extension CategoryWithRecipesCellModel { - - convenience init(category: MainCategory) { - let cellItems = category.recipes.map({ RecipeCellModel(recipe: $0) }) - self.init(categoryId: category.id, categoryImageURL: nil, categoryName: category.name, cellItems: cellItems) - } -} diff --git a/SampleProject/SampleProject/UIComponents/CommentCellModel+Extensions.swift b/SampleProject/SampleProject/UIComponents/CommentCellModel+Extensions.swift deleted file mode 100644 index 56e844d..0000000 --- a/SampleProject/SampleProject/UIComponents/CommentCellModel+Extensions.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// CommentCellModel+Extensions.swift -// SampleProject -// -// Created by Mehmet Salih Aslan on 15.11.2021. -// Copyright © 2021 Mobillium. All rights reserved. -// - -import MobilliumUserDefaults - -extension CommentCellModel { - - convenience init(comment: RecipeComment) { - let recipeAndFollowerCountText = "\(comment.user.recipeCount) \(L10n.General.recipe) \(comment.user.followedCount) \(L10n.General.follower)" - let isOwner = comment.user.id == DefaultsKey.userId.value - self.init(userId: comment.user.id, - imageUrl: comment.user.image?.url, - username: comment.user.username, - recipeAndFollowerCountText: recipeAndFollowerCountText, - timeDifferenceText: comment.timeDifference, - commentId: comment.id, - commentText: comment.text, - isOwner: isOwner) - } -} diff --git a/SampleProject/SampleProject/UIComponents/RecipeCellModel+Extension.swift b/SampleProject/SampleProject/UIComponents/RecipeCellModel+Extension.swift deleted file mode 100644 index ccf93cd..0000000 --- a/SampleProject/SampleProject/UIComponents/RecipeCellModel+Extension.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// RecipeCellViewModel+Extension.swift -// SampleProject -// -// Created by Murat Celebi on 2.06.2021. -// Copyright © 2021 Mobillium. All rights reserved. -// - -import Foundation - -extension RecipeCellModel { - - convenience init(recipe: Recipe) { - self.init(recipeId: recipe.id, - userId: recipe.user.id, - userImageUrl: recipe.user.image?.url, - username: recipe.user.username, - userRecipeAndFollowerCountText: "\(recipe.user.recipeCount) Tarif \(recipe.user.followingCount) Takipçi", - recipeTitle: recipe.title, - categoryName: recipe.category.name, - recipeImageUrl: recipe.images.first?.url, - recipeCommnetAndLikeCountText: "\(recipe.commentCount) Yorum \(recipe.likeCount) Beğeni", - isEditorChoice: recipe.isEditorChoice) - } -} diff --git a/SampleProject/UIComponents/UIComponents.xcodeproj/project.pbxproj b/SampleProject/UIComponents/UIComponents.xcodeproj/project.pbxproj index fbbb064..a3b68f4 100644 --- a/SampleProject/UIComponents/UIComponents.xcodeproj/project.pbxproj +++ b/SampleProject/UIComponents/UIComponents.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 1C39E0435D08B09D79582AD7 /* Pods_UIComponentsTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21582D1B374172423512A93A /* Pods_UIComponentsTests.framework */; }; 3D7478AA2628891100183ECA /* DynamicHeightCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D7478A92628891100183ECA /* DynamicHeightCollectionView.swift */; }; + 3DFAF37B28916668005D41A8 /* RecipeSmallCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DFAF37A28916668005D41A8 /* RecipeSmallCellModel.swift */; }; 5F9F89352628887000CD39E6 /* CommentInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F9F89342628887000CD39E6 /* CommentInputView.swift */; }; 6895F9D4FCA1DB6416A2BDA0 /* Pods_UIComponents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BDE3416577E7799BB5B2D409 /* Pods_UIComponents.framework */; }; 7A040F8A25E964E70052798D /* swiftgen.yml in Resources */ = {isa = PBXBuildFile; fileRef = 7A040F8925E964E70052798D /* swiftgen.yml */; }; @@ -87,6 +88,7 @@ 21582D1B374172423512A93A /* Pods_UIComponentsTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UIComponentsTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 225AC1A417A34A9F3F9171EF /* Pods-UIComponents.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UIComponents.release.xcconfig"; path = "Target Support Files/Pods-UIComponents/Pods-UIComponents.release.xcconfig"; sourceTree = ""; }; 3D7478A92628891100183ECA /* DynamicHeightCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicHeightCollectionView.swift; sourceTree = ""; }; + 3DFAF37A28916668005D41A8 /* RecipeSmallCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipeSmallCellModel.swift; sourceTree = ""; }; 42111B9624A77E5FF818F306 /* Pods-UIComponentsTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UIComponentsTests.release.xcconfig"; path = "Target Support Files/Pods-UIComponentsTests/Pods-UIComponentsTests.release.xcconfig"; sourceTree = ""; }; 5F9F89342628887000CD39E6 /* CommentInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentInputView.swift; sourceTree = ""; }; 62A4A7599A4C66EE4BB435EF /* Pods-UIComponents.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UIComponents.debug.xcconfig"; path = "Target Support Files/Pods-UIComponents/Pods-UIComponents.debug.xcconfig"; sourceTree = ""; }; @@ -464,6 +466,7 @@ A2B360D3260B3C6200FB990F /* RecipeCell.swift */, A2B360D4260B3C6200FB990F /* RecipeCellModel.swift */, A20A4B91260C78F800F1ACFF /* RecipeSmallCell.swift */, + 3DFAF37A28916668005D41A8 /* RecipeSmallCellModel.swift */, ); path = RecipeCell; sourceTree = ""; @@ -692,6 +695,7 @@ A20A4B92260C78F800F1ACFF /* RecipeSmallCell.swift in Sources */, 7A040FD025E966FF0052798D /* UIImage+Images.swift in Sources */, 7AFC73E0255200A300B30789 /* ReusableView.swift in Sources */, + 3DFAF37B28916668005D41A8 /* RecipeSmallCellModel.swift in Sources */, 7AFC73DD255200A300B30789 /* LoadingProtocol.swift in Sources */, A2B360DB260B3F4100FB990F /* UserView.swift in Sources */, A2176A1F261610FD008B3C46 /* WalkThroughCellModel.swift in Sources */, diff --git a/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCell.swift b/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCell.swift index b7622ab..5ae0a2f 100644 --- a/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCell.swift +++ b/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCell.swift @@ -22,7 +22,6 @@ public class CategoryWithRecipesCell: UICollectionViewCell, ReusableView { .build() private let seeAllButton = UIButtonBuilder() - .title(L10n.Modules.Favorites.seeAllButtonTitle) .titleColor(.appRed) .titleFont(.font(.nunitoBold, size: .small)) .backgroundColor(.clear) @@ -108,6 +107,7 @@ public extension CategoryWithRecipesCell { self.viewModel = viewModel self.categoryImageView.setImage(viewModel.categoryImageURL) self.categoryNameLabel.text = viewModel.categoryName + self.seeAllButton.setTitle(viewModel.seeAllButtonTitle, for: .normal) self.recipeSmallCellView.didSelectRecipe = viewModel.didSelectRecipe self.recipeSmallCellView.cellItems = viewModel.cellItems } diff --git a/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCellModel.swift b/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCellModel.swift index b290261..700d3c6 100644 --- a/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCellModel.swift +++ b/SampleProject/UIComponents/UIComponents/Cell/CategoryWithRecipesCell/CategoryWithRecipesCellModel.swift @@ -12,30 +12,13 @@ public protocol CategoryWithRecipesCellDataSource: AnyObject { var categoryId: Int { get } var categoryImageURL: String? { get } var categoryName: String? { get } - var cellItems: [RecipeCellProtocol] { get } + var seeAllButtonTitle: String? { get } + var cellItems: [RecipeSmallCellProtocol] { get } } public protocol CategoryWithRecipesCellEventSource: AnyObject { var didSelectRecipe: IntClosure? { get set } - var seeAllButtonTapped: ((Int, String) -> Void)? { get set } + var seeAllButtonTapped: TwoVariablesClosure? { get set } } -public protocol CategoryWithRecipesCellProtocol: CategoryWithRecipesCellDataSource, CategoryWithRecipesCellEventSource { - -} - -public final class CategoryWithRecipesCellModel: CategoryWithRecipesCellProtocol { - public var categoryId: Int - public var categoryImageURL: String? - public var categoryName: String? - public var seeAllButtonTapped: ((Int, String) -> Void)? - public var cellItems: [RecipeCellProtocol] - public var didSelectRecipe: IntClosure? - - public init(categoryId: Int, categoryImageURL: String?, categoryName: String?, cellItems: [RecipeCellProtocol]) { - self.categoryId = categoryId - self.categoryImageURL = categoryImageURL - self.categoryName = categoryName - self.cellItems = cellItems - } -} +public protocol CategoryWithRecipesCellProtocol: CategoryWithRecipesCellDataSource, CategoryWithRecipesCellEventSource {} diff --git a/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCell.swift b/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCell.swift index 7eedd1d..0e3ba9a 100644 --- a/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCell.swift +++ b/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCell.swift @@ -114,7 +114,7 @@ public extension CommentCell { self.viewModel = viewModel self.userView.userImageUrl = viewModel.imageUrl self.userView.username = viewModel.username - self.userView.recipeAndFollowerCountText = viewModel.recipeAndFollowerCountText + self.userView.recipeAndFollowerCountText = viewModel.userRecipeAndFollowerCountText self.timeDifferenceLabel.text = viewModel.timeDifferenceText self.commentLabel.text = viewModel.commentText self.moreButton.isHidden = !viewModel.isOwner diff --git a/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCellModel.swift b/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCellModel.swift index 66f7107..d50043a 100644 --- a/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCellModel.swift +++ b/SampleProject/UIComponents/UIComponents/Cell/CommentCell/CommentCellModel.swift @@ -9,12 +9,12 @@ import Foundation public protocol CommentCellDataSource: AnyObject { - var userId: Int { get } var imageUrl: String? { get } var username: String? { get } - var recipeAndFollowerCountText: String? { get } + var userFollowerCount: Int { get } + var userRecipeCount: Int { get } + var userRecipeAndFollowerCountText: String? { get } var timeDifferenceText: String? { get } - var commentId: Int { get } var commentText: String? { get set } var isOwner: Bool { get set } } @@ -26,34 +26,3 @@ public protocol CommentCellEventSource: AnyObject { public protocol CommentCellProtocol: CommentCellDataSource, CommentCellEventSource {} -public final class CommentCellModel: CommentCellProtocol { - - public var userId: Int - public var imageUrl: String? - public var username: String? - public var recipeAndFollowerCountText: String? - public var timeDifferenceText: String? - public var commentId: Int - public var commentText: String? - public var isOwner: Bool - public var moreButtonTapped: VoidClosure? - public var commentTextDidChanged: VoidClosure? - - public init(userId: Int, - imageUrl: String?, - username: String?, - recipeAndFollowerCountText: String?, - timeDifferenceText: String?, - commentId: Int, - commentText: String?, - isOwner: Bool) { - self.userId = userId - self.imageUrl = imageUrl - self.username = username - self.recipeAndFollowerCountText = recipeAndFollowerCountText - self.timeDifferenceText = timeDifferenceText - self.commentId = commentId - self.commentText = commentText - self.isOwner = isOwner - } -} diff --git a/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeCellModel.swift b/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeCellModel.swift index 93c16b5..3c1d634 100644 --- a/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeCellModel.swift +++ b/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeCellModel.swift @@ -9,14 +9,16 @@ import UIKit public protocol RecipeCellDataSource: AnyObject { - var recipeId: Int { get } - var userId: Int { get } var userImageUrl: String? { get } var username: String? { get } + var userFollowerCount: Int { get } + var userRecipeCount: Int { get } var userRecipeAndFollowerCountText: String? { get } var recipeTitle: String? { get } var categoryName: String? { get } var recipeImageUrl: String? { get } + var commentCount: Int { get } + var likeCount: Int { get } var recipeCommnetAndLikeCountText: String? { get } var isEditorChoice: Bool { get } } @@ -26,38 +28,3 @@ public protocol RecipeCellEventSource: AnyObject { } public protocol RecipeCellProtocol: RecipeCellDataSource, RecipeCellEventSource {} - -public class RecipeCellModel: RecipeCellProtocol { - public var recipeId: Int - public var userId: Int - public var userImageUrl: String? - public var username: String? - public var userRecipeAndFollowerCountText: String? - public var recipeTitle: String? - public var categoryName: String? - public var recipeImageUrl: String? - public var recipeCommnetAndLikeCountText: String? - public var isEditorChoice = false - public var followButtonTapped: VoidClosure? - - public init(recipeId: Int, - userId: Int, - userImageUrl: String?, - username: String?, - userRecipeAndFollowerCountText: String?, - recipeTitle: String?, categoryName: String?, - recipeImageUrl: String?, - recipeCommnetAndLikeCountText: String?, - isEditorChoice: Bool) { - self.recipeId = recipeId - self.userId = userId - self.userImageUrl = userImageUrl - self.username = username - self.userRecipeAndFollowerCountText = userRecipeAndFollowerCountText - self.recipeTitle = recipeTitle - self.categoryName = categoryName - self.recipeImageUrl = recipeImageUrl - self.recipeCommnetAndLikeCountText = recipeCommnetAndLikeCountText - self.isEditorChoice = isEditorChoice - } -} diff --git a/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeSmallCell.swift b/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeSmallCell.swift index ad900c8..bff035f 100644 --- a/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeSmallCell.swift +++ b/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeSmallCell.swift @@ -55,7 +55,7 @@ public class RecipeSmallCell: UICollectionViewCell, ReusableView { .textColor(.appRaven) .build() - weak var viewModel: RecipeCellProtocol? + weak var viewModel: RecipeSmallCellProtocol? override init(frame: CGRect) { super.init(frame: frame) @@ -145,7 +145,7 @@ extension RecipeSmallCell { // MARK: - Set ViewModel public extension RecipeSmallCell { - func set(with viewModel: RecipeCellProtocol) { + func set(with viewModel: RecipeSmallCellProtocol) { self.viewModel = viewModel self.recipeImageView.setImageScaled(viewModel.recipeImageUrl) self.userImageView.setImageScaled(viewModel.userImageUrl) diff --git a/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeSmallCellModel.swift b/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeSmallCellModel.swift new file mode 100644 index 0000000..4442333 --- /dev/null +++ b/SampleProject/UIComponents/UIComponents/Cell/RecipeCell/RecipeSmallCellModel.swift @@ -0,0 +1,29 @@ +// +// Model.swift +// UIComponents +// +// Created by Mehmet Salih Aslan on 27.07.2022. +// Copyright © 2022 Mobillium. All rights reserved. +// + +import UIKit + +public protocol RecipeSmallCellDataSource: AnyObject { + var recipeId: Int { get } + var userImageUrl: String? { get } + var username: String? { get } + var recipeTitle: String? { get } + var categoryName: String? { get } + var recipeImageUrl: String? { get } + var commentCount: Int { get } + var likeCount: Int { get } + var recipeCommnetAndLikeCountText: String? { get } + var isEditorChoice: Bool { get } +} + +public protocol RecipeSmallCellEventSource: AnyObject { + var followButtonTapped: VoidClosure? { get set } +} + +public protocol RecipeSmallCellProtocol: RecipeSmallCellDataSource, RecipeSmallCellEventSource {} + diff --git a/SampleProject/UIComponents/UIComponents/Cell/RecipeHeaderCell/RecipeHeaderCellModel.swift b/SampleProject/UIComponents/UIComponents/Cell/RecipeHeaderCell/RecipeHeaderCellModel.swift index 6e4c5d0..27ce246 100644 --- a/SampleProject/UIComponents/UIComponents/Cell/RecipeHeaderCell/RecipeHeaderCellModel.swift +++ b/SampleProject/UIComponents/UIComponents/Cell/RecipeHeaderCell/RecipeHeaderCellModel.swift @@ -20,13 +20,3 @@ public protocol RecipeHeaderCellEventSource { public protocol RecipeHeaderCellProtocol: RecipeHeaderCellDataSource, RecipeHeaderCellEventSource { } - -public final class RecipeHeaderCellModel: RecipeHeaderCellProtocol { - public var imageUrl: String - public var isEditorChoice: Bool - - public init(imageUrl: String, isEditorChoice: Bool) { - self.imageUrl = imageUrl - self.isEditorChoice = isEditorChoice - } -} diff --git a/SampleProject/UIComponents/UIComponents/Loading/BlockingActivityIndicator.swift b/SampleProject/UIComponents/UIComponents/Loading/BlockingActivityIndicator.swift index bf64a5f..f567f3e 100644 --- a/SampleProject/UIComponents/UIComponents/Loading/BlockingActivityIndicator.swift +++ b/SampleProject/UIComponents/UIComponents/Loading/BlockingActivityIndicator.swift @@ -13,7 +13,7 @@ final class BlockingActivityIndicator: UIView { private let activityIndicator: UIActivityIndicatorView override init(frame: CGRect) { - self.activityIndicator = UIActivityIndicatorView(style: .gray) + self.activityIndicator = UIActivityIndicatorView(style: .medium) activityIndicator.tintColor = .appWhite activityIndicator.color = .appWhite activityIndicator.startAnimating() diff --git a/SampleProject/UIComponents/UIComponents/UIActivityIndicatorView/ActivityIndicatorView.swift b/SampleProject/UIComponents/UIComponents/UIActivityIndicatorView/ActivityIndicatorView.swift index 0f07256..4d7a91a 100644 --- a/SampleProject/UIComponents/UIComponents/UIActivityIndicatorView/ActivityIndicatorView.swift +++ b/SampleProject/UIComponents/UIComponents/UIActivityIndicatorView/ActivityIndicatorView.swift @@ -21,7 +21,7 @@ public class ActivityIndicatorView: UIActivityIndicatorView { } private func commonInit() { - style = .gray + style = .medium tintColor = .appCinder hidesWhenStopped = true } diff --git a/SampleProject/UIComponents/UIComponents/UIView/RecipeSmallCellView.swift b/SampleProject/UIComponents/UIComponents/UIView/RecipeSmallCellView.swift index 56c565f..c3942b1 100644 --- a/SampleProject/UIComponents/UIComponents/UIView/RecipeSmallCellView.swift +++ b/SampleProject/UIComponents/UIComponents/UIView/RecipeSmallCellView.swift @@ -21,7 +21,7 @@ final public class RecipeSmallCellView: UIView { var didSelectRecipe: IntClosure? - public var cellItems: [RecipeCellProtocol]? { + public var cellItems: [RecipeSmallCellProtocol]? { didSet { self.collecitonView.reloadData() } diff --git a/SampleProject/Utilities/Utilities/Constants/Closures.swift b/SampleProject/Utilities/Utilities/Constants/Closures.swift index 59b89f4..59dbaa7 100644 --- a/SampleProject/Utilities/Utilities/Constants/Closures.swift +++ b/SampleProject/Utilities/Utilities/Constants/Closures.swift @@ -11,3 +11,4 @@ public typealias IntClosure = ((Int) -> Void) public typealias BoolClosure = ((Bool) -> Void) public typealias StringClosure = ((String) -> Void) public typealias IndexPathClosure = ((IndexPath) -> Void) +public typealias TwoVariablesClosure = ((A, B) -> Void) diff --git a/SampleProject/swiftgen.yml b/SampleProject/swiftgen.yml new file mode 100644 index 0000000..5e3a51b --- /dev/null +++ b/SampleProject/swiftgen.yml @@ -0,0 +1,8 @@ +strings: + inputs: SampleProject + filter: .+\.strings$ + outputs: + - templateName: structured-swift5 + output: SampleProject/Resources/Localizable.swift + params: + enumName: Localizable