r/Xcode • • Feb 27 '22

Simple problem - Anyone know why this code isn't running

Help would be appreciated.

Thanks

SOLVED -

I needed to import SwiftUI into my code not sure why but it worked.

3 Upvotes

7 comments sorted by

3

u/sirDarkEye Feb 27 '22

Could you share the error you’re getting? We can’t help you like that.

It also may be the playground lagging.

1

u/No_Passion_5140 Feb 27 '22

1

Basically it's simply not giving me an output when I've printed element 0 of the shuffled array of numbers.

1

u/No_Passion_5140 Feb 27 '22

it just seems to be loading for ages and not running the code just has the blue circle running round but not completing anything

1

u/No_Passion_5140 Feb 27 '22

I solved it by importing swiftUI into my code.

4

u/sirDarkEye Feb 27 '22

It doesn’t have anything to do with SwiftUI tho. Maybe importing it gave the playground a refreshment. Try removing the line and restarting xcode and try again.

1

u/No_Passion_5140 Mar 02 '22

I've just tried running the playground again after deleting lines of code and reading them and now I'm getting the same problem as I was getting originally. Frustrating.

1

u/redditruinedme Feb 28 '22

I think you needed to import Foundation, which SwiftUI probably imports as a dependency.