-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSideNavigationController+NestedTypes.swift
More file actions
78 lines (67 loc) · 2.5 KB
/
SideNavigationController+NestedTypes.swift
File metadata and controls
78 lines (67 loc) · 2.5 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
//
// SideNavigationController+NestedTypes.swift
// SideNavigationController
//
// Created by Benoit BRIATTE on 13/03/2017.
// Copyright © 2017 Digipolitan. All rights reserved.
//
import UIKit
public extension SideNavigationController {
enum Position {
case front
case back
}
struct Side {
public let viewController: UIViewController
public let options: Options
public init(viewController: UIViewController, options: Options) {
self.viewController = viewController
self.options = options
}
}
struct Options {
public static var defaultTintColor = UIColor.white
public var widthPercent: CGFloat
public var animationDuration: TimeInterval
public var overlayColor: UIColor
public var overlayOpacity: CGFloat
public var shadowOpacity: CGFloat
public var alwaysInteractionEnabled: Bool
public var panningEnabled: Bool
public var scale: CGFloat
public var position: Position
public var closeOnTouchOutside: Bool
public var shadowColor: UIColor {
get {
return UIColor(cgColor: self.shadowCGColor)
}
set(newValue) {
self.shadowCGColor = newValue.cgColor
}
}
public fileprivate(set) var shadowCGColor: CGColor!
public init(widthPercent: CGFloat = 0.33,
animationDuration: TimeInterval = 0.3,
overlayColor: UIColor = Options.defaultTintColor,
overlayOpacity: CGFloat = 0.5,
shadowColor: UIColor = Options.defaultTintColor,
shadowOpacity: CGFloat = 0.8,
alwaysInteractionEnabled: Bool = false,
panningEnabled: Bool = true,
scale: CGFloat = 1,
position: Position = .back,
closeOnTouchOutside: Bool = true) {
self.widthPercent = widthPercent
self.animationDuration = animationDuration
self.overlayColor = overlayColor
self.overlayOpacity = overlayOpacity
self.shadowOpacity = shadowOpacity
self.alwaysInteractionEnabled = alwaysInteractionEnabled
self.panningEnabled = panningEnabled
self.scale = scale
self.position = position
self.closeOnTouchOutside = closeOnTouchOutside
self.shadowColor = shadowColor
}
}
}