Skip to content

Files

Latest commit

 

History

History
35 lines (27 loc) · 1.3 KB

README.md

File metadata and controls

35 lines (27 loc) · 1.3 KB

Demonstrating how designing complex scrolling page UI can be easy.

It's like Lego® bricks:

  1. create your bricks, for exemple UserCollectionViewCell.swift + UserCollectionViewCell.xib
  2. 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
  }
}