Search code examples
swiftuistackaliasgroup

SwiftUI : aliases for Stack or Group


In order for me to better handle large bodies in Views (swiftUI) , i would like to rename/use some kind of alias for Group{} an/or Stack .I m looking to alias those elements, not to create additional subviews because it would add extra layer of communication between main view and sub views . So instead of Group{}, Group{},Group{}, I m looking for Group1{},Group2{} .. Thank you

Make code more readable


Solution

  • typealias Group1 = Group etc. seems to work but I strongly recommend breaking your view into separate view structs and/or use helper methods to move some of the views to separate functions. It would make your code much more readable and easier to understand.