Skip to content

Instantly share code, notes, and snippets.

@bdalziel
Created July 27, 2016 22:08
Show Gist options
  • Save bdalziel/fc04047116d10288a980cef445ad2ca6 to your computer and use it in GitHub Desktop.
Save bdalziel/fc04047116d10288a980cef445ad2ca6 to your computer and use it in GitHub Desktop.
+ (CGFloat)getSpacing:(ASPSpacingSize)size traitCollection:(UITraitCollection *)contextTraitCollection {
bool isCompact = !(contextTraitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular);
switch (size) {
case ASPSpacingSizeTiny :
return (isCompact) ? 8.0f : 16.0f;
case ASPSpacingSizeSmall :
return (isCompact) ? 16.0f : 24.0f;
case ASPSpacingSizeLarge :
return (isCompact) ? 24.0f : 48.0f;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment