Skip to content

Commit bcf2d37

Browse files
committed
Merge branch 'release/5.0.0' into main
2 parents a07ad8c + d7cb2d1 commit bcf2d37

30 files changed

+1037
-596
lines changed

.swiftformat

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# format options
2+
--binarygrouping none
3+
--closingparen balanced
4+
--commas inline
5+
--conflictmarkers reject
6+
7+
--decimalgrouping none
8+
--octalgrouping none
9+
--hexgrouping none
10+
11+
--elseposition next-line
12+
--guardelse same-line
13+
14+
--empty void
15+
--exponentcase lowercase
16+
--exponentgrouping disabled
17+
--fractiongrouping disabled
18+
--fragment false
19+
--header ignore
20+
--hexliteralcase uppercase
21+
--ifdef indent
22+
--importgrouping alphabetized
23+
--indent 4
24+
--linebreaks lf
25+
26+
--patternlet hoist
27+
--nospaceoperators
28+
--self remove
29+
--selfrequired
30+
--stripunusedargs closure-only
31+
--trailingclosures
32+
--trimwhitespace always
33+
--wraparguments before-first
34+
--wrapcollections before-first
35+
--xcodeindentation enabled
36+
--disable redundantReturn, wrapMultilineStatementBraces

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
22
- SwiftFormat/CLI (0.47.2)
3-
- TableViewContent (3.0.2)
3+
- TableViewContent (5.0.0)
44

55
DEPENDENCIES:
66
- SwiftFormat/CLI
@@ -16,7 +16,7 @@ EXTERNAL SOURCES:
1616

1717
SPEC CHECKSUMS:
1818
SwiftFormat: 0315a7115b15fd4ea2d043d5f5c22e3c98f84078
19-
TableViewContent: c14053186a1579cb9dbfe1173383e1ae75caf48b
19+
TableViewContent: de4ea2c1a0c0526a01cd18f8de0e5891e07ada69
2020

2121
PODFILE CHECKSUM: 35a8be3893318873897612545b5fea602dc5ba4d
2222

Example/TableViewContent.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
E90279612553DB300076246D /* CustomHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E90279602553DB300076246D /* CustomHeaderView.xib */; };
2020
E94A52C3216BBD440074BF82 /* CustomRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94A52C1216BBD440074BF82 /* CustomRow.swift */; };
2121
E94A52C4216BBD440074BF82 /* CustomTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E94A52C2216BBD440074BF82 /* CustomTableViewCell.xib */; };
22+
E9EECF1D256DA9E200606D3E /* ColorHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EECF1C256DA9E200606D3E /* ColorHeaderView.swift */; };
2223
/* End PBXBuildFile section */
2324

2425
/* Begin PBXContainerItemProxy section */
@@ -53,6 +54,7 @@
5354
E90279602553DB300076246D /* CustomHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CustomHeaderView.xib; sourceTree = "<group>"; };
5455
E94A52C1216BBD440074BF82 /* CustomRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRow.swift; sourceTree = "<group>"; };
5556
E94A52C2216BBD440074BF82 /* CustomTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CustomTableViewCell.xib; sourceTree = "<group>"; };
57+
E9EECF1C256DA9E200606D3E /* ColorHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorHeaderView.swift; sourceTree = "<group>"; };
5658
F1D0D8B5537BDF9787B774A8 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
5759
FC47E3A09CA4830F57C9306C /* TableViewContent.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = TableViewContent.podspec; path = ../TableViewContent.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
5860
/* End PBXFileReference section */
@@ -114,6 +116,7 @@
114116
children = (
115117
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
116118
607FACD71AFB9204008FA782 /* ViewController.swift */,
119+
E9EECF1C256DA9E200606D3E /* ColorHeaderView.swift */,
117120
E94A52C1216BBD440074BF82 /* CustomRow.swift */,
118121
E94A52C2216BBD440074BF82 /* CustomTableViewCell.xib */,
119122
607FACD91AFB9204008FA782 /* Main.storyboard */,
@@ -366,6 +369,7 @@
366369
E94A52C3216BBD440074BF82 /* CustomRow.swift in Sources */,
367370
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
368371
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
372+
E9EECF1D256DA9E200606D3E /* ColorHeaderView.swift in Sources */,
369373
);
370374
runOnlyForDeploymentPostprocessing = 0;
371375
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// ColorHeaderView.swift
3+
// TableViewContent_Example
4+
//
5+
// Created by Akira Matsuda on 2020/11/25.
6+
// Copyright © 2020 CocoaPods. All rights reserved.
7+
//
8+
9+
import TableViewContent
10+
import UIKit
11+
12+
class ColorHeaderView: UIView, SectionConfigurable {
13+
init(height: CGFloat) {
14+
super.init(frame: .zero)
15+
NSLayoutConstraint.activate([
16+
heightAnchor.constraint(equalToConstant: height)
17+
])
18+
}
19+
20+
@available(*, unavailable)
21+
required init?(coder _: NSCoder) {
22+
fatalError("init(coder:) has not been implemented")
23+
}
24+
25+
func configure(_ data: Any) {
26+
guard let color = data as? UIColor else {
27+
return
28+
}
29+
backgroundColor = color
30+
}
31+
}

Example/TableViewContent/CustomRow.swift

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,37 @@ import TableViewContent
1010
import UIKit
1111

1212
class CustomTableViewCell: UITableViewCell {
13-
@IBOutlet var button: UIButton!
13+
public typealias Action = () -> Void
14+
15+
@IBOutlet private var button: UIButton!
16+
var buttonPressedAction: Action = {}
17+
18+
override func awakeFromNib() {
19+
super.awakeFromNib()
20+
button.addTarget(self, action: #selector(buttonPressed(_:)), for: .touchUpInside)
21+
}
22+
23+
@objc
24+
private func buttonPressed(_: UIButton) {
25+
buttonPressedAction()
26+
}
1427
}
1528

16-
class CustomRow: RowRepresentation {
29+
class CustomRow: Row<CustomTableViewCell> {
1730
public typealias Action = () -> Void
1831

1932
private var buttonPressedAction: Action = {}
2033

2134
init() {
22-
super.init(nib: UINib(nibName: "CustomTableViewCell", bundle: nil), cellType: CustomTableViewCell.self, reuseIdentifier: "CustomTableViewCell", data: nil)
23-
configure(CustomTableViewCell.self) { [unowned self] cell, _, _ in
24-
cell.button.addTarget(self, action: #selector(self.buttonPressed), for: .touchUpInside)
25-
}
35+
super.init(
36+
.nib(.init(nibName: "CustomTableViewCell", bundle: nil)),
37+
reuseIdentifier: NSStringFromClass(CustomTableViewCell.self)
38+
)
39+
selectionStyle(.none)
40+
}
41+
42+
override func defaultCellConfiguration(_ cell: CustomTableViewCell, _ indexPath: IndexPath) {
43+
cell.buttonPressedAction = buttonPressedAction
2644
}
2745

2846
convenience init(_ action: @escaping Action) {
@@ -36,7 +54,8 @@ class CustomRow: RowRepresentation {
3654
return self
3755
}
3856

39-
@objc private func buttonPressed() {
57+
@objc
58+
private func buttonPressed() {
4059
buttonPressedAction()
4160
}
4261
}

Example/TableViewContent/CustomTableViewCell.xib

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina4_7" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99
</dependencies>
@@ -18,15 +18,15 @@
1818
<autoresizingMask key="autoresizingMask"/>
1919
<subviews>
2020
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VFu-v5-Enw">
21-
<rect key="frame" x="118" y="6" width="84" height="30.5"/>
21+
<rect key="frame" x="8" y="6" width="304" height="30.5"/>
2222
<state key="normal" title="Custom Cell"/>
2323
</button>
2424
</subviews>
2525
<constraints>
2626
<constraint firstAttribute="bottom" secondItem="VFu-v5-Enw" secondAttribute="bottom" constant="7.5" id="I9O-1c-13d"/>
2727
<constraint firstItem="VFu-v5-Enw" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="IOW-2u-sUe"/>
28-
<constraint firstAttribute="trailing" secondItem="VFu-v5-Enw" secondAttribute="trailing" constant="118" id="bJj-Md-dAa"/>
29-
<constraint firstItem="VFu-v5-Enw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="118" id="gE0-ze-zfA"/>
28+
<constraint firstAttribute="trailing" secondItem="VFu-v5-Enw" secondAttribute="trailing" constant="8" id="MlE-9F-d23"/>
29+
<constraint firstItem="VFu-v5-Enw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="8" id="dJf-Qi-eKW"/>
3030
</constraints>
3131
</tableViewCellContentView>
3232
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>

0 commit comments

Comments
 (0)