Skip to content

Add dynamic sizing to base collection view#11

Merged
vadymmarkov merged 5 commits intomasterfrom
improve/dynamic-height-calculations
Oct 5, 2015
Merged

Add dynamic sizing to base collection view#11
vadymmarkov merged 5 commits intomasterfrom
improve/dynamic-height-calculations

Conversation

@zenangst
Copy link
Copy Markdown
Owner

@zenangst zenangst commented Oct 4, 2015

Based on this JSON, it will render the following;

{
 "components" : [
  {
    "type" : "list",
    "title" : "iOS Developers",
    "items" : [
      {
        "type"     : "contact",
        "image"    : "https://hyper-production.s3.amazonaws.com/uploads/user/alternate_photo/62/forealz__B2P7135_1.jpg",
        "title"    : "Vadym Markov",
        "subtitle" : "iOS Developer",
        "target"   : {
          "uri" : "components:contact:1"
        }
      },
      {
        "type"     : "contact",
        "image"    : "https://hyper-production.s3.amazonaws.com/uploads/user/alternate_photo/67/forealz__B2P7125_1.jpg",
        "title"    : "Ramon Gilabert Llop",
        "subtitle" : "iOS Developer",
        "target"   : {
          "uri" : "components:contact:1"
        }
      },
      {
        "type"     : "contact",
        "image"    : "https://hyper-production.s3.amazonaws.com/uploads/user/alternate_photo/45/forealz_hyperportrait_christoffer_alt.jpg",
        "title"    : "Christoffer Winterkvist",
        "subtitle" : "iOS Developer",
        "target"   : {
          "uri" : "components:contact:1"
        }
      }
    ]
  },
  {
    "type" : "list",
    "title" : "Android Developers",
    "items" : [
      {
        "type"     : "contact",
        "image"    : "https://hyper-production.s3.amazonaws.com/uploads/user/alternate_photo/31/forealz_hyperportrait_espena_alt.jpg",
        "title"    : "Espen Almdahl",
        "subtitle" : "Android Developer",
        "target"   : {
          "uri" : "components:contact:1"
        }
      },
      {
        "type"     : "contact",
        "image"    : "https://hyper-production.s3.amazonaws.com/uploads/user/alternate_photo/69/forealz__B2P7321_1.jpg",
        "title"    : "Damian Lopata",
        "subtitle" : "Android Developer",
        "target"   : {
          "uri" : "components:contact:1"
        }
      },
      {
        "type"     : "contact",
        "image"    : "https://hyper-production.s3.amazonaws.com/uploads/user/alternate_photo/70/forealz__B2P7269_1.jpg",
        "title"    : "Jean Tuffier",
        "subtitle" : "Android Developer",
        "target"   : {
          "uri" : "components:contact:1"
        }
      },
      {
        "type"     : "contact",
        "image"    : "https://hyper-production.s3.amazonaws.com/uploads/user/alternate_photo/65/forealz_hyperportraits_chang.jpg",
        "title"    : "Chang Xiangzhong",
        "subtitle" : "Android Developer",
        "target"   : {
          "uri" : "components:contact:1"
        }
      }
    ]
  }
  ]
}

simulator screen shot 04 oct 2015 21 43 07

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could have some lazy var view instead of func render, because now we're creating the view 2 times, here and in cellForItemAtIndexPath.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vadymmarkov Is that really true when dealing with reference types? render() is just returning the lazy loaded component from inside.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zenangst Yeah, forgot what we have in render 😃

@vadymmarkov
Copy link
Copy Markdown
Collaborator

@zenangst This is awesome ⭐

vadymmarkov added a commit that referenced this pull request Oct 5, 2015
…ions

Add dynamic sizing to base collection view
@vadymmarkov vadymmarkov merged commit 4675b13 into master Oct 5, 2015
@vadymmarkov vadymmarkov deleted the improve/dynamic-height-calculations branch October 5, 2015 06:42
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

Successfully merging this pull request may close these issues.

2 participants