Demonstrating how designing complex scrolling page UI can be easy.
It's like Lego® bricks:
- create your bricks, for exemple UserCollectionViewCell.swift + UserCollectionViewCell.xib
- reference your bricks in the
Item
enum
And that's it 😃
You are ready to build your design by assembling your own bricks.
Example:
class ViewController: UIViewController {
@IBOutlet weak var collectionView: ItemCollectionView!
// Here is your design:
let items: [Item] = [
.image(source: headerImageUrl),
.user(profilePictureSource: userImageUrl, username: "John Doe"),
.collection(items: [
.user(profilePictureSource: user.father.imageUrl, username: "Korben Dallas"),
.user(profilePictureSource: user.mother.imageUrl, username: "Lilou Dallas")
], scrollDirection: .horizontal),
.text(user.bio),
.image(source: footerImageUrl)
]
override func viewDidLoad() {
super.viewDidLoad()
collectionView.items = items
}
}