Skip to content

Commit f753ee2

Browse files
committed
add Hashable conformance and make some properties public
1 parent feff0ea commit f753ee2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

swift/sources/CustardKit.swift

+12-12
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public extension CustardInterface {
418418

419419
/// - キーのデザイン
420420
/// - design information of key
421-
public struct CustardKeyDesign: Codable, Equatable {
421+
public struct CustardKeyDesign: Codable, Equatable, Hashable {
422422
public init(label: CustardKeyLabelStyle, color: CustardKeyDesign.ColorType) {
423423
self.label = label
424424
self.color = color
@@ -437,7 +437,7 @@ public struct CustardKeyDesign: Codable, Equatable {
437437

438438
/// - バリエーションのキーのデザイン
439439
/// - design information of key
440-
public struct CustardVariationKeyDesign: Codable, Equatable {
440+
public struct CustardVariationKeyDesign: Codable, Equatable, Hashable {
441441
public init(label: CustardKeyLabelStyle) {
442442
self.label = label
443443
}
@@ -447,13 +447,13 @@ public struct CustardVariationKeyDesign: Codable, Equatable {
447447

448448
/// - キーに指定するラベル
449449
/// - labels on the key
450-
public enum CustardKeyLabelStyle: Codable, Equatable {
450+
public enum CustardKeyLabelStyle: Codable, Equatable, Hashable {
451451
case text(String)
452452
case systemImage(String)
453453
}
454454

455-
public extension CustardKeyLabelStyle{
456-
private enum CodingKeys: CodingKey{
455+
public extension CustardKeyLabelStyle {
456+
private enum CodingKeys: CodingKey {
457457
case text
458458
case system_image
459459
}
@@ -502,13 +502,13 @@ public extension CustardKeyLabelStyle{
502502
}
503503

504504
/// - key's data in interface
505-
public enum CustardInterfaceKey: Equatable {
505+
public enum CustardInterfaceKey: Equatable, Hashable {
506506
case system(CustardInterfaceSystemKey)
507507
case custom(CustardInterfaceCustomKey)
508508
}
509509

510510
/// - keys prepared in default
511-
public enum CustardInterfaceSystemKey: Codable, Equatable {
511+
public enum CustardInterfaceSystemKey: Codable, Equatable, Hashable {
512512
/// - the globe key
513513
case changeKeyboard
514514

@@ -583,7 +583,7 @@ public extension CustardInterfaceSystemKey{
583583
}
584584

585585
/// - keys you can defined
586-
public struct CustardInterfaceCustomKey: Codable, Equatable {
586+
public struct CustardInterfaceCustomKey: Codable, Equatable, Hashable {
587587
public init(design: CustardKeyDesign, press_actions: [CodableActionData], longpress_actions: CodableLongpressActionData, variations: [CustardInterfaceVariation]) {
588588
self.design = design
589589
self.press_actions = press_actions
@@ -734,7 +734,7 @@ public extension CustardInterfaceCustomKey {
734734
}
735735

736736
/// - variation of key, includes flick keys and selectable variations in pc style keyboard.
737-
public struct CustardInterfaceVariation: Codable, Equatable {
737+
public struct CustardInterfaceVariation: Codable, Equatable, Hashable {
738738
public init(type: VariationType, key: CustardInterfaceVariationKey) {
739739
self.type = type
740740
self.key = key
@@ -748,7 +748,7 @@ public struct CustardInterfaceVariation: Codable, Equatable {
748748

749749
/// - キーの変種の種類
750750
/// - type of key variation
751-
public enum VariationType: Equatable {
751+
public enum VariationType: Equatable, Hashable {
752752
/// - variation of flick
753753
/// - warning: when you use pc style, this type of variation would be ignored.
754754
case flickVariation(FlickDirection)
@@ -805,7 +805,7 @@ public extension CustardInterfaceVariation {
805805
}
806806

807807
/// - data of variation key
808-
public struct CustardInterfaceVariationKey: Codable, Equatable {
808+
public struct CustardInterfaceVariationKey: Codable, Equatable, Hashable {
809809
public init(design: CustardVariationKeyDesign, press_actions: [CodableActionData], longpress_actions: CodableLongpressActionData) {
810810
self.design = design
811811
self.press_actions = press_actions
@@ -1111,7 +1111,7 @@ public extension CodableActionData{
11111111
}
11121112

11131113

1114-
public struct CodableLongpressActionData: Codable, Equatable {
1114+
public struct CodableLongpressActionData: Codable, Equatable, Hashable {
11151115
public static let none = CodableLongpressActionData()
11161116
public init(start: [CodableActionData] = [], repeat: [CodableActionData] = []) {
11171117
self.start = start

0 commit comments

Comments
 (0)