/SSHoneyCombView

a honey comb View that looks like a collection view with hexagon shaped items

Primary LanguageSwiftMIT LicenseMIT

SSHoneyCombView

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Minimum iOS 8, Swift 3

Screenshots

Alt text

Installation

SSHoneyCombView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SSHoneyCombView'

Make sure to: use_frameworks!

Usage

1- add SSHoneyCombView.framework to “Linked Frameworks and Libraries” under Target->General, and build

storyboard: 2- drag and drop a UIView and change both “Class” and “Module” to SSHoneyCombView

3- resize your SSHoneyCombView and add constraints to use Autoresizing

4- create an outlet in your ViewController (Ex. ssHoneyCombView)

in ViewController:

5-

import SSHoneyCombView

6- create and array of SSHoneyCombObject

var honeycombObjectsArray: [SSHoneyCombObject] = []

create and append SSHoneyCombObject to honeycombObjectsArray Ex.

for i in 0...99 {
   let honeycombObject = SSHoneyCombObject()
   honeycombObject.name = "Honey Object \(i)"
   self.honeycombObjectsArray.append(honeycombObject)
}

and assign this array to self.ssHoneyCombView.honeyCombObjects

self.ssHoneyCombView.honeyCombObjects = self.honeycombObjectsArray

7- optional you can set numberOfItemsInRow

self.honeyCombView.numberOfItemsInRow = 7

//NOTE: numberOfItemsInRow can’t be less than 2

8- conform to SSHoneyCombViewDelegate

9- set delegate

self.ssHoneyCombView.delegate = self

10-

func SSHoneyComb(_ SSHoneyComb: SSHoneyCombView, didSelect item: SSHoneyCombObject) {
    print(item.name)
}

Finally you can add variables to HoneyCombObject class to fit your needs basic HoneyCombObject has “name” property only

for more details, please refer to Example Project

Author

Sameh Salama

samehsalama@hotmail.com

https://eg.linkedin.com/in/sameh-salama-98389174

http://DaBlueAlien.com

License

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