yannickl / Splitflap

A simple split-flap display for your Swift applications
http://cocoadocs.org/docsets/Splitflap
MIT License
1.08k stars 79 forks source link

TwelveHourClock format #5

Closed deivuh closed 7 years ago

deivuh commented 7 years ago

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.

yannickl commented 7 years ago

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.

deivuh commented 7 years ago

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

Danielthenew commented 7 years ago

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 :)

yannickl commented 7 years ago

@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 + ":"
}