스플래시 페이지 추가
This commit is contained in:
32
SodaLive/Sources/Extensions/IntExtension.swift
Normal file
32
SodaLive/Sources/Extensions/IntExtension.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// IntExtension.swift
|
||||
// yozm
|
||||
//
|
||||
// Created by klaus on 2022/06/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Int64 {
|
||||
func durationText() -> String {
|
||||
let duration = self
|
||||
|
||||
let convertedTime = Int(duration / 1000)
|
||||
let hour = Int(convertedTime / 3600)
|
||||
let minute = Int(convertedTime / 60) % 60
|
||||
let second = Int(convertedTime % 60)
|
||||
|
||||
// update UI
|
||||
var timeText = [String]()
|
||||
|
||||
if hour > 0 {
|
||||
timeText.append(String(hour))
|
||||
timeText.append(String(format: "%02d", minute))
|
||||
} else {
|
||||
timeText.append(String(format: "%02d", minute))
|
||||
timeText.append(String(format: "%02d", second))
|
||||
}
|
||||
|
||||
return timeText.joined(separator: ":")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user