Closed jimijon closed 3 years ago
@jimijon does it compile if you uncomment just this line self.queryCallback()
?
nope: /Users/James/Development/TrendPlaySwiftUI/TrendPlay2/TrendPlay2/BaseWidgetClasses/TrendSlider.swift:323:17: Expression type 'HorizontalRangeSliderStyle<, , _>' is ambiguous without more context
This used to work in 0.6. I shipped a product last year.. updating for release this year and now have these two bugs.
Really would like to get these two problems resolved before the weekend is over if possible as I have an impatient client... I really don't want to migrate backwards. Thanks for the great component otherwise!
@jimijon you have onEditingChanged
in Style initializer. But it should be in the slider init. Try it.
Error: Extra argument onEditingChanged
var hRangeSlider: some View {
return RangeSlider(range: $range)
.rangeSliderStyle(
HorizontalRangeSliderStyle(
track:
HorizontalRangeTrack(
view: Capsule().foregroundColor(Color("TPOrange"))
)
.background(Capsule().foregroundColor(Color("TPOrange").opacity(0.30)))
.frame(height: 8),
lowerThumb: Circle().foregroundColor(Color(UIColor(named: "TPLightGrey")!)),
upperThumb: Circle().foregroundColor(Color(UIColor(named: "TPLightGrey")!)),
lowerThumbSize: CGSize(width: 32, height: 32),
upperThumbSize: CGSize(width: 32, height: 32),
options: .forceAdjacentValue
),
onEditingChanged: {
value in
if !value {
self.queryCallback()
}
}
).padding([.horizontal]).frame(height: 64)
}
OH THE INITS! I missed those (upgrading threw me off)
This fixes both of my issues:
return RangeSlider(range: $range, in: lBound...uBound, step: 1, onEditingChanged: { value in if !value {self.queryCallback()}}) .rangeSliderStyle( HorizontalRangeSliderStyle(
track:
HorizontalRangeTrack(
view: Capsule().foregroundColor(Color("TPOrange"))
)
.background(Capsule().foregroundColor(Color("TPOrange").opacity(0.30)))
.frame(height: 8),
lowerThumb: Circle().foregroundColor(Color(UIColor(named: "TPLightGrey")!)),
upperThumb: Circle().foregroundColor(Color(UIColor(named: "TPLightGrey")!)),
lowerThumbSize: CGSize(width: 32, height: 32),
upperThumbSize: CGSize(width: 32, height: 32),
options: .forceAdjacentValue
)
).padding([.horizontal]).frame(height: 64)
I can't get this to compile: If I take out onEditingChange it will compile.