-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathYouTubePlayer+Event.swift
48 lines (34 loc) · 1 KB
/
YouTubePlayer+Event.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import Foundation
// MARK: - YouTubePlayer+Event
public extension YouTubePlayer {
/// A YouTubePlayer event.
struct Event: Codable, Hashable, Sendable {
// MARK: Properties
/// The name.
public var name: Name
/// The data.
public var data: Data?
// MARK: Initializer
/// Creates a new instance of ``YouTubePlayer/Event``
/// - Parameters:
/// - name: The name.
/// - data: The data. Default value `nil`
public init(
name: Name,
data: Data? = nil
) {
self.name = name
self.data = data
}
}
}
// MARK: - CustomStringConvertible
extension YouTubePlayer.Event: CustomStringConvertible {
/// A textual representation of this instance.
public var description: String {
"""
Name: \(self.name.rawValue)
Data: \(self.data?.value ?? "nil")
"""
}
}