Challenge: Draw the Rings | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/18176818-your-first-ios-and-swiftui-app-polishing-the-app/lessons/20

hello!

i am using xcode 12.4 and i am not able to have the .fill modifier work on the circle in the ForEach loop. the compiler rejects the .fill modifier with a series of error messages:

at the opening curly brace for the ForEach loop the error reads:

Unable to infer complex closure return type; add explicit type to disambiguate

and

at the .fill modifier the error reads:

Value of type ‘some View’ has no member ‘fill’

I have tried reordering the modifiers with no luck.

Also, the video deals with the ‘light’ mode look, and does it address the dark mode look?

i love the tutorial. great job as always.

thanks Ray!

cheers,

guata

@guatambu Hey Michael! I just tried this on Xcode 12.4 and it seems to work OK for me:

I wonder if you might have a slight typo somewhere? I would suggest comparing your code to the solution in our materials repo (see 20-challenge-draw-the-rings\Final).

Regarding dark mode, we talk a bit about that in the next video… the rings look “ok-ish” on dark mode except they are slightly too bright, so we show how to fix that. :]

I hope this helps and let me know if you have any other questions!

thanks Ray! got it sorted from the starter project files. no clue what i did, maybe just Xcode being Xcode sometimes. thanks and keep up all the awesome tutorials!

1 Like

Hi! Based on my understanding of the topic, I would have concluded that the startRadius for the radialGradient should be set at 50 to match up with the smallest ring, rather than the 100 recommended in the video. Visually it doesn’t seem to make a significant difference, but I would like to make sure I’m understanding this correctly. If 100 is the better solution, can you explain why? Thanks so much!

@morganduverney Yeah I think you’re right that according to the design 50 would have been more accurate, since the innermost ring has 0.8 opacity, next 0.6 etc. Looks like it was a mistake on my part! However I just tried it and I see the same thing you’re seeing, that visually it doesn’t make a huge difference either way.

1 Like

I can’t use fill and stroke at the same time, if I use stroke and then I try to use fill XCode shows an error:

Value of type ‘some View’ has no member ‘fill’

Here’s my solution: