Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed May 26, 2020
1 parent 9465e1b commit 6691135
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class UserCollection: ObservableObject {
return added
}

public func containVariant(item: Item, variant: Variant) -> Bool {
public func variantIn(item: Item, variant: Variant) -> Bool {
guard let filename = item.filename else {
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct CollectionListView: View {
@State private var sheet: Sheet.SheetType?

private var categories: [String] {
Array(Set(collection.items.map({ $0.category })))
Array(Set(collection.items.map(\.category))).sorted()
}

var body: some View {
Expand Down
5 changes: 3 additions & 2 deletions ACHNBrowserUI/ACHNBrowserUI/views/shared/LikeButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import SwiftUI
import Backend

struct LikeButtonView: View {
@EnvironmentObject private var collection: UserCollection

let item: Item?
let variant: Variant?
let villager: Villager?
@EnvironmentObject private var collection: UserCollection

init(item: Item, variant: Variant?) {
self.item = item
Expand All @@ -30,7 +31,7 @@ struct LikeButtonView: View {
private var isInCollection: Bool {
if let item = item {
if let variant = variant {
return collection.containVariant(item: item, variant: variant)
return collection.variantIn(item: item, variant: variant)
}
return collection.items.contains(item) || collection.critters.contains(item)
} else if let villager = villager {
Expand Down

0 comments on commit 6691135

Please sign in to comment.