Skip to content

Commit 1116604

Browse files
committed
added missing files
1 parent 7db8f8a commit 1116604

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

UIKitExtensions/OwnView.swift

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// CustomView.swift
3+
// Pods
4+
//
5+
// Created by Nicolas LELOUP on 31/08/2017.
6+
//
7+
//
8+
9+
import Foundation
10+
import SnapKit
11+
import UIKit
12+
13+
protocol OwnViewProtocol {
14+
var viewName: String { get }
15+
}
16+
17+
class OwnView: UIView {
18+
var contentView: UIView!
19+
20+
override init(frame: CGRect) {
21+
super.init(frame: frame)
22+
self.loadView()
23+
}
24+
25+
required init(coder: NSCoder) {
26+
super.init(coder: coder)!
27+
self.loadView()
28+
}
29+
30+
func loadView() {
31+
if let conformingProtocolView = self as? OwnViewProtocol {
32+
self.contentView = Bundle.main.loadNibNamed(
33+
conformingProtocolView.viewName,
34+
owner: self,
35+
options: nil
36+
)?.last as? UIView
37+
self.addSubview(self.contentView)
38+
self.contentView.snp.makeConstraints({ (maker) in
39+
maker.edges.equalTo(self)
40+
})
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)