yannickl/Splitflap

TwelveHourClock format

deivuh opened this issue · 4 comments

Hi!

First of all thanks for this great component. This is exactly was I was looking for and I like that it has Swift 3 support already.

I was looking at the pre defined tokens in SplitflapTokens. I think the TwelveHourClock token should have a 2 digits format just like the 24hour and minutes/seconds one.

It works as expected. Except that each flap display one digit, like in this photo:

splitflap1

Of course you can create clocks with 2 digits per flap but the 1 digit per flap covers more use cases.

I see, it was intended then. I will close the PR.

Hey
I also wanna use it to print a clock i have set SplitflapTokens.TwelveHourClock but i can´t set the numbers when i try it with splitflap.setText("11:59", animated: true) in a button it print me hours but he print not the double point and the minutes.

numberOfFlapsInSplitflap i have set to 5

Thanks for your answer :)

@Danielthenew This is because the : is not available in the TwelveHourClock token list.

You should add it in the tokensInSplitflap method:

func tokensInSplitflap(_ splitflap: Splitflap) -> [String] {
  return SplitflapTokens.TwelveHourClock + ":"
}