Friday, August 19, 2022
HomeiOS Developmentios - In Swift/SwiftUI, once we use structs resembling Textual content, or...

ios – In Swift/SwiftUI, once we use structs resembling Textual content, or Picture, are the thought-about situations? How?


For instance Textual content is taken into account a struct in SwiftUI. However you’ll be able to modify the colour with out creating an object.

** When you change the background coloration of a View (simply for instance) in UIKit, you faucet into the colour property of an object, However in SwiftUI, it is like I’m tapping into properties of a struct which feels unimaginable.
For instance to vary the View in UIKit,

view = UIView()
view.backgroundColor = .crimson

— This makes good sense to me

This following instance doesn’t make sense to me. I can memorize the syntax, nevertheless it would not make sense:

Textual content("Hey world!")
  .background(Shade.crimson)

So my query is, precisely what am I tapping into? Am I truly tapping right into a property of a struct? Within the SwiftUI instance, Textual content is a struct, however I’m utilizing the dot syntax altering properties?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments