Skip to content

Commit

Permalink
Edit readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
fortmarek committed Jun 15, 2019
1 parent 7ecb6d4 commit 52c325c
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ This should be done before passing your view controller into the init method of

To specify which view controller should be selected first:
```swift
// Selecting second view controller as the first
swipeViewController.startIndex = 1
```
It should also be said that the first view controller index starts at zero, just like arrays.

### NavigationBar

Expand All @@ -69,57 +69,54 @@ You can also include barButtonItems, simply create UIBarButtonItem as you would

```swift
let barButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: nil)
setNavigationWithItem(UIColor.whiteColor(), leftItem: barButtonItem, rightItem: nil)
leftBarButtonItem = barButtonItem
```

Note this should be done probably in `viewDidLoad` (definitely before the view appears).

### SwipeButtons

There are two different modes - either every button has the same space on each side not depending on the label size (good for odd numbers)
```swift
equalSpaces = true
swipeViewController.equalSpaces = true
```

or the spaces on each differ depending on the label size (good for even numbers, the label is always centered).
```swift
equalSpaces = false
swipeViewController.equalSpaces = false
```

You can either customize buttons with this function:
You can also customize buttons with these properties:
```swift
setButtons(UIFont.systemFontOfSize(18), color: .black)
```
Or if you want to change the color of the buttons depending on which page the user is on:

```swift
setButtonsWithSelectedColor(UIFont.systemFontOfSize(18), color: .black, selectedColor: .white)
buttonFont, buttonColor, selectedButtonColor
```

To change the offsets on the side and on the bottom:

```swift
setButtonsOffset(40, bottomOffset: 5)
swipeViewController.offset = 40 // offset from the side
swipeViewController.bottomOffset = 5 // offset from the bottom
```

Instead of titles as labels you can use images. First init the button using SwipeButtonWithImage struct:

```swift
let buttonOne = SwipeButtonWithImage(image: UIImage(named: "Hearts"), selectedImage: UIImage(named: "YellowHearts"), size: CGSize(width: 40, height: 40))
setButtonsWithImages([buttonOne, buttonTwo, buttonThree])
swipeViewController.buttonsWithImages = [buttonOne, buttonTwo, buttonThree]
```

### SelectionBar

To customize selection bar, use this function:
To customize selection bar, you can change these properties:

```swift
setSelectionBar(80, height: 3, color: .black)
selectionBarHeight, selectionBarWidth, selectionBarColor
```

### Additional customization

If you want to customize it even more, you can go right to the the SwipeViewController class file but be careful.


## Author

fortmarek, [email protected]
Expand Down

0 comments on commit 52c325c

Please sign in to comment.