Skip to content

Commit 6c2942b

Browse files
author
Maika Akedo
committed
duration property type change to Int, add Initializer
1 parent d7c8496 commit 6c2942b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

StudyplusSDK/StudyplusRecord.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public struct StudyplusRecord {
7474
The seconds of the learning.
7575
勉強した時間(秒数)です。
7676
*/
77-
public let duration: Double
77+
public let duration: Int
7878

7979
/**
8080
The date and time of learning.
@@ -105,8 +105,26 @@ public struct StudyplusRecord {
105105
/// - recordedAt: Time the learning is ended. 学習を終えた日時。
106106
/// - amount: The amount of learning. 学習量。
107107
/// - comment: Studyplus timeline comment. Studyplusのタイムライン上で表示されるコメント。
108+
@available(*, deprecated, message: "Use Int type duration initializer instead")
108109
public init(duration: Double, recordedAt: Date = Date(), amount: StudyplusRecordAmount? = nil, comment: String? = nil) {
109110

111+
self.duration = Int(duration)
112+
self.recordedAt = recordedAt
113+
self.amount = amount
114+
self.comment = comment
115+
}
116+
117+
/// Initialize StudyplusRecord object.
118+
///
119+
/// 勉強記録オブジェクトを作成します。
120+
///
121+
/// - Parameters:
122+
/// - duration: Specify the seconds of the learning. 勉強した時間(秒数)を指定してください。
123+
/// - recordedAt: Time the learning is ended. 学習を終えた日時。
124+
/// - amount: The amount of learning. 学習量。
125+
/// - comment: Studyplus timeline comment. Studyplusのタイムライン上で表示されるコメント。
126+
public init(duration: Int, recordedAt: Date = Date(), amount: StudyplusRecordAmount? = nil, comment: String? = nil) {
127+
110128
self.duration = duration
111129
self.recordedAt = recordedAt
112130
self.amount = amount

0 commit comments

Comments
 (0)