Skip to content

Instantly share code, notes, and snippets.

@GeekTree0101
Created November 5, 2021 07:34
Show Gist options
  • Save GeekTree0101/6ce05fbda4196e58d76e6ff3c72c500a to your computer and use it in GitHub Desktop.
Save GeekTree0101/6ce05fbda4196e58d76e6ff3c72c500a to your computer and use it in GitHub Desktop.
jay
struct ViewModel {
let id: Int
let name: String
let hasLock: Bool
}
let groups: [FleaMarketGroup] = ...
let viewModels: [ViewModel] = groups.map { hasLock: true } + [ViewModel( hasLock: false)]
// UI
// hasLock -> 자물쇠 유무
override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
return ASStackLayoutSpec(
direction: .horizontal,
spacing: 5.8,
justifyContent: .start,
alignItems: .center,
children: [
self.radioButtonNode,
self.viewModel.hasLock == true ? self.lockerImageNode : nil
].comapactMap { $0 }
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment