yonat / MultiSelectSegmentedControl

UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New version of MultiSelectSegmentedControl import issue

jamiedaniel opened this issue · comments

Description of the problem:
Inside any new project, the newer version of MultiSelectSegmentedControl (2.0+) doesn't get cast to a UISegmentedControl anymore. Perviously when I wanted to use MultiSelectSegmentedControl I could include this in an array with oath UISegmentedControls and they would work inter-operably, now the compiler will not allow that behavior.

Minimal project that reproduces the problem (so I'll be able to figure out how to fix it):

  • Create a new project using the new version of MultiSelectSegmentedControl
  • create 2 UISegementedControls on the main VIewController
  • add a MMultiSelectSegmentedControl to the main ViewController
  • Create @IBOutlet references to all three.
  • add all three to an array of type [UISegmentedControl]

The last step on compile will give you an error where in the past it didn't.

iOS 13 changed UISegmentedControl in a way that makes it impossible to implement multi-selection, so I had to change MultiSelectSegmentedControl so that it's no longer a subclass of UISegmentedControl.

You'll have to use an array of UIView or UIControl instead.