Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DevLog/Domain/Entity/WebPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct WebPage {
struct WebPage: Equatable {
let title: String?
let url: URL
let displayURL: URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ struct ProfileSelectedDayActivity: Identifiable, Hashable {
return showsCreated ? "생성" : "완료"
}

static func == (lhs: Self, rhs: Self) -> Bool {
lhs.todo.id == rhs.todo.id
&& lhs.showsCreated == rhs.showsCreated
&& lhs.showsCompleted == rhs.showsCompleted
}

func hash(into hasher: inout Hasher) {
hasher.combine(todo.id)
hasher.combine(showsCreated)
Expand Down
4 changes: 0 additions & 4 deletions DevLog/Presentation/Structure/PushNotificationItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ struct PushNotificationItem: Identifiable, Hashable {
self.todoCategory = notification.todoCategory
}

static func == (lhs: PushNotificationItem, rhs: PushNotificationItem) -> Bool {
lhs.id == rhs.id
}

func hash(into hasher: inout Hasher) {
hasher.combine(id)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 모든 프로퍼티를 비교하게 되는데, 현재 hash(into:) 구현은 id 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.

hash(into:)가 합성된 ==와 일관성을 갖도록 모든 프로퍼티를 해싱하도록 수정해야 합니다.

    func hash(into hasher: inout Hasher) {
        hasher.combine(id)
        hasher.combine(title)
        hasher.combine(body)
        hasher.combine(receivedAt)
        hasher.combine(isRead)
        hasher.combine(todoId)
        hasher.combine(todoCategory)
    }

Expand Down
4 changes: 0 additions & 4 deletions DevLog/Presentation/Structure/RecentTodoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ struct RecentTodoItem: Identifiable, Hashable {
self.category = todo.category
}

static func == (lhs: RecentTodoItem, rhs: RecentTodoItem) -> Bool {
lhs.id == rhs.id
}

func hash(into hasher: inout Hasher) {
hasher.combine(id)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 모든 프로퍼티를 비교하게 되는데, 현재 hash(into:) 구현은 id 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.

hash(into:)가 합성된 ==와 일관성을 갖도록 모든 프로퍼티를 해싱하도록 수정해야 합니다.

    func hash(into hasher: inout Hasher) {
        hasher.combine(id)
        hasher.combine(number)
        hasher.combine(title)
        hasher.combine(isPinned)
        hasher.combine(updatedAt)
        hasher.combine(tags)
        hasher.combine(category)
    }

Expand Down
4 changes: 0 additions & 4 deletions DevLog/Presentation/Structure/TodayTodoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ struct TodayTodoItem: Identifiable, Hashable {
self.category = todo.category
}

static func == (lhs: TodayTodoItem, rhs: TodayTodoItem) -> Bool {
lhs.id == rhs.id
}

func hash(into hasher: inout Hasher) {
hasher.combine(id)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 모든 프로퍼티를 비교하게 되는데, 현재 hash(into:) 구현은 id 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.

hash(into:)가 합성된 ==와 일관성을 갖도록 모든 프로퍼티를 해싱하도록 수정해야 합니다.

    func hash(into hasher: inout Hasher) {
        hasher.combine(id)
        hasher.combine(number)
        hasher.combine(title)
        hasher.combine(tags)
        hasher.combine(isPinned)
        hasher.combine(updatedAt)
        hasher.combine(dueDate)
        hasher.combine(category)
    }

Expand Down
6 changes: 0 additions & 6 deletions DevLog/Presentation/Structure/WebPageItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ struct WebPageItem: Identifiable, Hashable {
var url: URL { metadata.url }
var displayURL: String { metadata.displayURL.absoluteString }
var imageURL: URL? { metadata.imageURL }
}

extension WebPageItem {
func hash(into hasher: inout Hasher) {
hasher.combine(metadata.url)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 metadata 프로퍼티 전체를 비교하게 되는데, 현재 hash(into:) 구현은 metadata.url 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.

hash(into:)가 합성된 ==와 일관성을 갖도록 metadata의 모든 프로퍼티를 해싱하도록 수정해야 합니다. 가장 좋은 방법은 WebPage 타입을 Hashable로 만드는 것이지만, 그것이 불가능하다면 아래와 같이 직접 프로퍼티를 해싱해야 합니다.

    func hash(into hasher: inout Hasher) {
        hasher.combine(metadata.title)
        hasher.combine(metadata.url)
        hasher.combine(metadata.displayURL)
        hasher.combine(metadata.imageURL)
    }


static func == (lhs: WebPageItem, rhs: WebPageItem) -> Bool {
lhs.metadata.url == rhs.metadata.url
}
}