Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不合理的append方法,建议优化下。 #3

Open
CalvinChina opened this issue Jan 13, 2024 · 1 comment
Open

不合理的append方法,建议优化下。 #3

CalvinChina opened this issue Jan 13, 2024 · 1 comment

Comments

@CalvinChina
Copy link

// MARK: - 一、数组 的基本扩展
public extension Array {

// MARK: 1.2、数组新增元素(可转入一个数组)
/// 数组新增元素(可转入一个数组)
/// - Parameter elements: 数组
mutating func append(_ elements: [Element]) {
    for element in elements {
        self.append(element)
    }
}

}
这个Array的扩展会导致HStack 无法直接循环添加 viewBuilder:

      HStack() {
        for model in users {
      view
 
        }
    }

这个问题还排查了很久才定位到这个组件,建议抽空优化下。我目前解决的解决方案是直接删除掉这个append函数。
@zjinhu
Copy link
Owner

zjinhu commented Jan 15, 2024

可能和swift系统的append方法冲突了,我先注释掉,等抽空解决一下,这个Brick主要是针对UIKit用的,我还有另外一个Brick_SwiftUI是针对SwiftUI写的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants