muizidn / FastUI

Swift is Fast! Your SwiftUI in iOS 8.0!
https://muizidn.github.io/FastUI
1 stars 0 forks source link

Get rid off `configure` #3

Closed muizidn closed 4 years ago

muizidn commented 4 years ago

func configure is just a simple helper where direct method call to the api's causes confusion to the Swift compiler.

You may want to check it with

VStack {
  HStack()
    .foregroundColor(.blue)
    .flex_height(100)
}
.foregroundColor(.cyan)

Code above (with more view stacks being added) intermittently causes compiler to spits ambiguity error without clear direction to where the confusion occurs.

Sometimes, it can be resolved by switching the order of method call. Sure, it is very bad indeed. Because it hides the real problem and it will breaks soon. Once you change a code, it maybe won't compile again.

And also, the compiler seems to be confused and failed to interpret expression which normally will not happen. This is being investigated whether the source of problem is the lack of some keyword (because we can't use it) which results the abuse of protocol or the problem lies in the compiler itself.

Screen Shot 2020-01-27 at 17 26 16

Until the real fix shows up, we advice to use this function to configure SomeView instance. And yeah, this is the main source of @discardableResult attribute in all methods.

muizidn commented 4 years ago

Fixed since 484462e47f3483742ba095171af45c91f54369ca

muizidn commented 4 years ago

But I'll write some more explanations.