可以为类快速覆盖 ==(_:_:)hash(into:) 方法 (isEqual:hash 用于 Objective-C)。按 &shortcut:Generate; 并选择 equals 和 hash (-isEqual: 和 hash 用于 Objective-C) 。在打开的对话框中,选择应添加到 ==(_:_:)hash(into:) 方法的属性:

Select properties to be added to equals and hash