-3

Example of segmented progress bar:

enter image description here

  • Is there some way to duplicate this progress bar using swift.
pkc456
  • 8,350
  • 38
  • 53
  • 109
kelson_99
  • 37
  • 2
  • 1
    Honestly if you're just getting started. Simply use a horizontal UIStackView to draw the ten squares of color. Change each one to either red or gray. beyond that you'd have to learn how to use CALayers in a custom UIView – Fattie May 14 '21 at 20:46
  • Even easier if you’re using SwiftUI. If you want a SwiftUI version, I’ll gladly post an answer. – aheze May 14 '21 at 21:24
  • @aheze I'm searching for a segmented progress bar in SwiftUI. I would be happy if you show me your solution. Thank you very much. – Mina Aug 15 '23 at 21:52

2 Answers2

0

I don't think you could do this with a UIProgressBar but it would be trivial to create your own control that had a Float value property that ranged from 0 to 1 and drew a colored bar based on the value.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
0

Good afternoon I had exactly the same question, I solved it by creating several identical vii

I created for example 7 different views with indents from each other, that's what happenedenter image description here

Denim
  • 9
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34294078) –  May 01 '23 at 14:06