All Projects → vinnyoodles → Mosaic Layout

vinnyoodles / Mosaic Layout

Licence: mit
A mosaic collection view layout inspired by Lightbox's Algorithm, written in Swift 🔶

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Mosaic Layout

Nef
💊 steroids for Xcode Playgrounds
Stars: ✭ 226 (-9.24%)
Mutual labels:  cocoapods
Fkdownloader
👍🏻📥Maybe the best file downloader.
Stars: ✭ 231 (-7.23%)
Mutual labels:  cocoapods
Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (-2.81%)
Mutual labels:  cocoapods
Swiftvalidators
String (and more) validation for iOS
Stars: ✭ 226 (-9.24%)
Mutual labels:  cocoapods
Swipycell
Easy to use UITableViewCell implementing swiping to trigger actions.
Stars: ✭ 230 (-7.63%)
Mutual labels:  cocoapods
Rhplaceholder
Show pleasant loading view for your users 😍
Stars: ✭ 238 (-4.42%)
Mutual labels:  cocoapods
Ccnstatusitem
CCNStatusItem is a subclass of NSObject to act as a custom view for NSStatusItem. It supports a customizable statusItemWindow handling any viewController for presenting the content.
Stars: ✭ 223 (-10.44%)
Mutual labels:  cocoapods
Jjfloatingactionbutton
Floating Action Button for iOS
Stars: ✭ 243 (-2.41%)
Mutual labels:  cocoapods
Aws Mobile Appsync Sdk Ios
iOS SDK for AWS AppSync.
Stars: ✭ 231 (-7.23%)
Mutual labels:  cocoapods
Sensor Visualizer Kit
Visualize iOS sensors for live presentations, iOS AppStore demos, Apple Store prototypes, design reviews.
Stars: ✭ 242 (-2.81%)
Mutual labels:  cocoapods
Sync
JSON to Core Data and back. Swift Core Data Sync.
Stars: ✭ 2,538 (+919.28%)
Mutual labels:  cocoapods
Gifu
High-performance animated GIF support for iOS in Swift
Stars: ✭ 2,703 (+985.54%)
Mutual labels:  cocoapods
Dtpagercontroller
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
Stars: ✭ 240 (-3.61%)
Mutual labels:  cocoapods
Admozaiccollectionviewlayout
ADMozaicCollectionViewLayout is yet another UICollectionViewLayout subclass that implements "brick", "mozaic" or Pinterest style layout.
Stars: ✭ 226 (-9.24%)
Mutual labels:  cocoapods
Harpy
Harpy checks a user's currently installed version of your iOS app against the version that is currently available in the App Store. If a new version is available, an alert can be presented to the user informing them of the newer version, and giving them the option to update the application.
Stars: ✭ 2,619 (+951.81%)
Mutual labels:  cocoapods
Tutti
Tutti is a Swift library that lets you create tutorials, hints and onboarding experiences.
Stars: ✭ 224 (-10.04%)
Mutual labels:  cocoapods
Swiftpagemenu
Customizable Page Tab Menu Controller 👍
Stars: ✭ 233 (-6.43%)
Mutual labels:  cocoapods
Autoarchive
一个基于Jenkins的iOS/Android自动构建系统,它实现了最大程度的自动化,让你的iOS自动打包,Android自动打包流程变得更加高效。此项目包含了各种实现细节的讲解说明,你能够使用它解决大多数跟客户端构建/分发相关的问题,并将这种能力进行开放,提高研发效率。
Stars: ✭ 248 (-0.4%)
Mutual labels:  cocoapods
Fire
🔥A delightful HTTP/HTTPS networking framework for iOS/macOS/watchOS/tvOS platforms written in Swift.
Stars: ✭ 243 (-2.41%)
Mutual labels:  cocoapods
Imagescrollview
Scrollable and zoomable image view for iOS in Swift
Stars: ✭ 239 (-4.02%)
Mutual labels:  cocoapods

TRMosaicLayout

CI Status codebeat badge Version License Platform

A mosaic collection view layout inspired by Lightbox's Algorithm. This is a swift implementation/extension of @fmitech's FMMosaicLayout. The standard UICollectionViewFlowLayout can be a boring presentation in your app, but TRMosaicLayout is a simple feature that will engage your users with your eyecatching content. If you don't believe me, checkout Snapchat's app and their awesome layout in their Discover feed.

TRMosaicLayout implementation

Similar implementation used by @snapchat

Why use this

  • TRMosaicLayout is great for displaying images that are in portrait or have a similar aspect ratio
  • Examples
    • Movie posters
    • Book covers
    • Magazines
    • News articles

Installation

CocoaPods

You can use CocoaPods to install TRMosaicLayout by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'TRMosaicLayout'

Then, import TRMosaicLayout

import TRMosaicLayout

Manually

  1. Download and drop /TRMosaicLayoutfolder in your project.
  2. Congratulations!

Implementation

Create a subclass of UICollectionViewController

import TRMosaicLayout

class TRCollectionViewController: UICollectionViewController {
  override func viewDidLoad() {
    super.viewDidLoad()

      let mosaicLayout = TRMosaicLayout()
      self.collectionView?.collectionViewLayout = mosaicLayout
      mosaicLayout.delegate = self
  }
}

Extend your subclass of UICollectionViewController with TRMosaicLayoutDelegate

extension TRCollectionViewController: TRMosaicLayoutDelegate {

  func collectionView(collectionView:UICollectionView, mosaicCellSizeTypeAtIndexPath indexPath:NSIndexPath) -> TRMosaicCellType {
    // I recommend setting every third cell as .Big to get the best layout
    return indexPath.item % 3 == 0 ? TRMosaicCellType.Big : TRMosaicCellType.Small
  }

  func collectionView(collectionView:UICollectionView, layout collectionViewLayout: TRMosaicLayout, insetAtSection:Int) -> UIEdgeInsets {
    return UIEdgeInsets(top: 3, left: 3, bottom: 3, right: 3)
  }

  func heightForSmallMosaicCell() -> CGFloat {
    return 150
  }
}

Troubleshooting

The cell's aren't aligned properly

  • Make sure the views you are adding to the cell have the correct frame
  let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath)
  let imageView = UIImageView(image: image)
  imageView.frame = cell.frame
  cell.backgroundView = imageView
  return cell

Getting a nil while unwrapping error

  • Make sure you set the delegate of TRMosaicLayout to your collectionViewController
  • mosaicLayout.delegate = self

Something else isn't working properly

  • Use github's issue reporter on the right, this will you be your best bet as I'm on Github fairly regularly
  • Send me an email [email protected]

Release History

  • 1.0.0 Update to Swift 3
  • 0.1.0 First release on CocoaPods

Contributions

I am happy to accept any open contributions. Just fork this project, make the changes and submit a pull request.

Author

Vincent Le, [email protected]

License

TRMosaicLayout is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].