Skip to content

Commit

Permalink
[Feat] #471 - Set Access Modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jim4020key committed Jul 24, 2023
1 parent 44476df commit d51f2f4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI

final class ExploreShortcutViewModel: ObservableObject {

var shortcutsZipViewModel = ShortcutsZipViewModel.share
private let shortcutsZipViewModel = ShortcutsZipViewModel.share

@Published private(set) var isCategoryCellViewFolded = true
@Published var isTappedAnnouncementCell = false
Expand All @@ -24,7 +24,11 @@ final class ExploreShortcutViewModel: ObservableObject {
isTappedAnnouncementCell = true
}

func fetchShortcutsByCategories(category: Category) -> [Shortcuts] {
func fetchShortcuts(by category: Category) -> [Shortcuts] {
shortcutsZipViewModel.shortcutsInCategory[category.index]
}

func fetchShortcuts(by sectionType: SectionType) -> [Shortcuts] {
sectionType.filterShortcuts(from: shortcutsZipViewModel)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI

final class ListCategoryShortcutViewModel: ObservableObject {

var shortcutsZipViewModel = ShortcutsZipViewModel.share
private let shortcutsZipViewModel = ShortcutsZipViewModel.share

@Published private(set) var shortcuts: [Shortcuts] = []
@Published private(set) var category: Category = .business
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import SwiftUI

final class ListShortcutViewModel: ObservableObject {

var shortcutsZipViewModel = ShortcutsZipViewModel.share
private let shortcutsZipViewModel = ShortcutsZipViewModel.share

@Published private(set) var shortcuts: [Shortcuts] = []
@Published private(set) var sectionType: SectionType = .download


init(data: SectionType) {
sectionType = data
shortcuts = fetchShortcutsBySectionType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extension ExploreShortcutView {
@ViewBuilder
private func sectionView(with sectionType: SectionType) -> some View {

let shortcuts = sectionType.filterShortcuts(from: viewModel.shortcutsZipViewModel)
let shortcuts = viewModel.fetchShortcuts(by: sectionType)

VStack(spacing: 0) {
HStack {
Expand Down Expand Up @@ -157,7 +157,7 @@ extension ExploreShortcutView {

ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(viewModel.fetchShortcutsByCategories(category: category).prefix(7), id: \.self) { shortcut in
ForEach(viewModel.fetchShortcuts(by: category).prefix(7), id: \.self) { shortcut in
let data = NavigationReadShortcutType(
shortcutID: shortcut.id,
navigationParentView: .shortcuts)
Expand Down

0 comments on commit d51f2f4

Please sign in to comment.