Latest 1.0.1
Homepage https://github.com/vinaychopra90/HairLine
License MIT
Platforms ios 9.0
Authors

Hairline draws crisp separators in Tableview / Collection View or NavigationBar .
Often custom design requires separators which can’t be achieved with native separators as its a shadow.

Hairline is used for :

  1. Creating custom navigation bar separator
  2. Creating UITableViewCell / UICollectionViewCell separators.
  3. Separating 2 segments

———–you can add these separators to achieve hairline behavior

Problems with current Apple API :

Apple does not allow to draw half pixel, even if you forcefully try to give a Constraint constant = 0.5
In case of navigation bar, Apple itself draw a shadow which looks like a hairline of half pixel.
As shadows are drawn outside the view boundary we need to make sure clipsToBounds & masksToBounds is false.

So what Next….trying more alternatives
Naah !!!

Here comes rescue from all these tiring stuff :

Pathway:

  1. Create a 1px View
  2. Apply necessary constraints
  3. Provide a class in Identity Inspector

Yeahhh…..Yes you are done with these tiny steps :)

You need to have a checkpoint
Sometimes iOS simulator works in a buggy fashion.
——–How to Check ,It’s simple either increase or decrease the size of simulator (xCode 9+).

Though it works well (100%) on Device.

I have zoomed in the screenshot to show the difference.

screen shot 2018-03-09 at 5 26 30 pm

Contributing

Issues and Feature Requests are welcome!

Author

Created with :heart: by Vinay Chopra

Twitter: @vinaychopra90

Cheers.

Latest podspec

{
    "name": "HairLine",
    "version": "1.0.1",
    "summary": "This is the first release of this project.",
    "description": "Hairline draws crisp separators in Tableview / Collection View or NavigationBar . Often custom design requires separators which can't be achieved with native separators as its a shadow.",
    "homepage": "https://github.com/vinaychopra90/HairLine",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "": ""
    },
    "source": {
        "git": "https://github.com/vinaychopra90/HairLine.git",
        "tag": "1.0.1"
    },
    "swift_version": "3.2",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "HairLine/HairLine.swift"
}

Pin It on Pinterest

Share This