This repository was archived by the owner on Jun 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 442
Expand file tree
/
Copy pathMenuViewCustomizable.swift
More file actions
88 lines (80 loc) · 2.37 KB
/
MenuViewCustomizable.swift
File metadata and controls
88 lines (80 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// MenuViewCustomizable.swift
// PagingMenuController
//
// Created by Yusuke Kita on 5/23/16.
// Copyright (c) 2015 kitasuke. All rights reserved.
//
import Foundation
public protocol MenuViewCustomizable {
var backgroundColor: UIColor { get }
var selectedBackgroundColor: UIColor { get }
var height: CGFloat { get }
var animationDuration: TimeInterval { get }
var deceleratingRate: CGFloat { get }
var selectedItemCenter: Bool { get }
var displayMode: MenuDisplayMode { get }
var focusMode: MenuFocusMode { get }
var dummyItemViewsSet: Int { get }
var menuPosition: MenuPosition { get }
var dividerImage: UIImage? { get }
var itemsOptions: [MenuItemViewCustomizable] { get }
}
public extension MenuViewCustomizable {
var backgroundColor: UIColor {
return UIColor.white
}
var selectedBackgroundColor: UIColor {
return UIColor.white
}
var height: CGFloat {
return 50
}
var animationDuration: TimeInterval {
return 0.3
}
var deceleratingRate: CGFloat {
return UIScrollView.DecelerationRate.fast.rawValue
}
var selectedItemCenter: Bool {
return true
}
var displayMode: MenuDisplayMode {
return .standard(widthMode: .flexible, centerItem: false, scrollingMode: .pagingEnabled)
}
var focusMode: MenuFocusMode {
return .underline(height: 3, color: UIColor.blue, horizontalPadding: 0, verticalPadding: 0)
}
var dummyItemViewsSet: Int {
return 3
}
var menuPosition: MenuPosition {
return .top
}
var dividerImage: UIImage? {
return nil
}
}
public enum MenuDisplayMode {
case standard(widthMode: MenuItemWidthMode, centerItem: Bool, scrollingMode: MenuScrollingMode)
case segmentedControl
case infinite(widthMode: MenuItemWidthMode, scrollingMode: MenuScrollingMode)
}
public enum MenuItemWidthMode {
case flexible
case fixed(width: CGFloat)
}
public enum MenuScrollingMode {
case scrollEnabled
case scrollEnabledAndBouces
case pagingEnabled
}
public enum MenuFocusMode {
case none
case underline(height: CGFloat, color: UIColor, horizontalPadding: CGFloat, verticalPadding: CGFloat)
case roundRect(radius: CGFloat, horizontalPadding: CGFloat, verticalPadding: CGFloat, selectedColor: UIColor)
}
public enum MenuPosition {
case top
case bottom
}