Skip to content

Instantly share code, notes, and snippets.

@ryotapoi
Created November 2, 2020 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryotapoi/140d8055946d8a7f422453fa911fbf74 to your computer and use it in GitHub Desktop.
Save ryotapoi/140d8055946d8a7f422453fa911fbf74 to your computer and use it in GitHub Desktop.
経過時間などを表す mm:ss 形式のフォーマット
import Foundation
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .positional
formatter.allowedUnits = [.minute, .second]
formatter.zeroFormattingBehavior = .pad
formatter.string(from: 61)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment