Hello guys,
I am fetching a string from a server, and print it in a text field. It works fine:
let remoteContent = fetched.content
Text(remoteContent)
If I split it, and try to print elements, I get a black screen.
I tried casting substring to String and NSString etc. but didn't manage to get it to work.
I'm new to Swift and I must say... It's quite overwhelming!
Here's the problematic code:
let remoteContentArray = remoteContent.split(separator: Character(","))
Text(String(remoteContentArray[0]))
I tried it in the playground and it works fine.
But in a view no chance.
I tried directly using a dummy string like "some,words,separated,by,commas"
And it works! But why does it behave like this with the fetched string?
PS. Is it just me, or is Swift kinda hostile to learn?
Thanks a lot.
Selecting any option will automatically load the page