From c9ea6de3d503ea6a3b6b58dd86459ab47f0fa014 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Thu, 21 Mar 2024 02:01:11 +0100 Subject: [PATCH] Implemented the TopWord model in the Feed framework. --- .../Logic/Extensions/TopWord+DTOs.swift | 23 +++++++++++++++++++ .../Bundle/Sources/Logic/Models/TopWord.swift | 16 +++++++++++++ Reviews.xcodeproj/project.pbxproj | 8 +++++++ 3 files changed, 47 insertions(+) create mode 100644 Frameworks/Feed/Bundle/Sources/Logic/Extensions/TopWord+DTOs.swift create mode 100644 Frameworks/Feed/Bundle/Sources/Logic/Models/TopWord.swift diff --git a/Frameworks/Feed/Bundle/Sources/Logic/Extensions/TopWord+DTOs.swift b/Frameworks/Feed/Bundle/Sources/Logic/Extensions/TopWord+DTOs.swift new file mode 100644 index 0000000..8f1fb6a --- /dev/null +++ b/Frameworks/Feed/Bundle/Sources/Logic/Extensions/TopWord+DTOs.swift @@ -0,0 +1,23 @@ +// +// TopWord+DTOs.swift +// ReviewsFeed +// +// Created by Javier Cicchelli on 21/03/2024. +// Copyright © 2024 Röck+Cöde. All rights reserved. +// + +import Foundation +import ReviewsFilterKit + +extension TopWord { + + // MARK: Initialisers + init(_ dto: WordCount) { + self = .init( + id: UUID().uuidString, + term: dto.word.term, + count: dto.count + ) + } + +} diff --git a/Frameworks/Feed/Bundle/Sources/Logic/Models/TopWord.swift b/Frameworks/Feed/Bundle/Sources/Logic/Models/TopWord.swift new file mode 100644 index 0000000..8db97e8 --- /dev/null +++ b/Frameworks/Feed/Bundle/Sources/Logic/Models/TopWord.swift @@ -0,0 +1,16 @@ +// +// TopWord.swift +// ReviewsFeed +// +// Created by Javier Cicchelli on 21/03/2024. +// Copyright © 2024 Röck+Cöde. All rights reserved. +// + +struct TopWord: Identifiable { + + // MARK: Constants + let id: String + let term: String + let count: Int + +} diff --git a/Reviews.xcodeproj/project.pbxproj b/Reviews.xcodeproj/project.pbxproj index f674b36..d9358a5 100644 --- a/Reviews.xcodeproj/project.pbxproj +++ b/Reviews.xcodeproj/project.pbxproj @@ -24,6 +24,8 @@ 02DC7FB52BA52520000EEEBE /* ReviewsKit in Frameworks */ = {isa = PBXBuildFile; productRef = 02DC7FB42BA52520000EEEBE /* ReviewsKit */; }; 02EACF2E2BABA34600FF8ECD /* FeedItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02EACF2D2BABA34600FF8ECD /* FeedItemCell.swift */; }; 02EACF302BABA50D00FF8ECD /* TopWordsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02EACF2F2BABA50D00FF8ECD /* TopWordsCell.swift */; }; + 02EACF342BABB28900FF8ECD /* TopWord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02EACF332BABB28900FF8ECD /* TopWord.swift */; }; + 02EACF362BABB2F200FF8ECD /* TopWord+DTOs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02EACF352BABB2F200FF8ECD /* TopWord+DTOs.swift */; }; 345AD11C24C6EDD9004E2EE1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 345AD11B24C6EDD9004E2EE1 /* AppDelegate.swift */; }; 345AD12524C6EDDC004E2EE1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 345AD12424C6EDDC004E2EE1 /* Assets.xcassets */; }; 345AD12824C6EDDC004E2EE1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 345AD12624C6EDDC004E2EE1 /* LaunchScreen.storyboard */; }; @@ -66,6 +68,8 @@ 02DC7FB12BA52084000EEEBE /* Libraries */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Libraries; sourceTree = ""; }; 02EACF2D2BABA34600FF8ECD /* FeedItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedItemCell.swift; sourceTree = ""; }; 02EACF2F2BABA50D00FF8ECD /* TopWordsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopWordsCell.swift; sourceTree = ""; }; + 02EACF332BABB28900FF8ECD /* TopWord.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopWord.swift; sourceTree = ""; }; + 02EACF352BABB2F200FF8ECD /* TopWord+DTOs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TopWord+DTOs.swift"; sourceTree = ""; }; 345AD11824C6EDD9004E2EE1 /* Reviews.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Reviews.app; sourceTree = BUILT_PRODUCTS_DIR; }; 345AD11B24C6EDD9004E2EE1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 345AD12424C6EDDC004E2EE1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -103,6 +107,7 @@ 02909E7A2BAB6D2E00710E14 /* Bundle+Constants.swift */, 023AC7FB2BAA3EC10027D064 /* Int+Constants.swift */, 02909E7C2BAB7FFE00710E14 /* Review+DTOs.swift */, + 02EACF352BABB2F200FF8ECD /* TopWord+DTOs.swift */, ); path = Extensions; sourceTree = ""; @@ -157,6 +162,7 @@ isa = PBXGroup; children = ( 345AD13124C6EE64004E2EE1 /* Review.swift */, + 02EACF332BABB28900FF8ECD /* TopWord.swift */, ); path = Models; sourceTree = ""; @@ -429,12 +435,14 @@ files = ( 02EACF302BABA50D00FF8ECD /* TopWordsCell.swift in Sources */, 02620B8C2BA89C9A00DE7137 /* FeedListViewModel.swift in Sources */, + 02EACF342BABB28900FF8ECD /* TopWord.swift in Sources */, 023AC7FC2BAA3EC10027D064 /* Int+Constants.swift in Sources */, 02DC7FAC2BA51B4C000EEEBE /* FeedItemViewController.swift in Sources */, 02909E7B2BAB6D2E00710E14 /* Bundle+Constants.swift in Sources */, 02EACF2E2BABA34600FF8ECD /* FeedItemCell.swift in Sources */, 02909E7D2BAB7FFE00710E14 /* Review+DTOs.swift in Sources */, 0220ADA32BA90646001E6A9F /* FeedItemView.swift in Sources */, + 02EACF362BABB2F200FF8ECD /* TopWord+DTOs.swift in Sources */, 02DC7FAF2BA51B4C000EEEBE /* Review.swift in Sources */, 02DC7FAE2BA51B4C000EEEBE /* FeedListViewController.swift in Sources */, 02909E792BAB6B0200710E14 /* FilterOption.swift in Sources */,