Skip to content

Commit

Permalink
Merge branch 'release/5.0.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0c committed Dec 3, 2020
2 parents a07ad8c + d7cb2d1 commit bcf2d37
Show file tree
Hide file tree
Showing 30 changed files with 1,037 additions and 596 deletions.
36 changes: 36 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# format options
--binarygrouping none
--closingparen balanced
--commas inline
--conflictmarkers reject

--decimalgrouping none
--octalgrouping none
--hexgrouping none

--elseposition next-line
--guardelse same-line

--empty void
--exponentcase lowercase
--exponentgrouping disabled
--fractiongrouping disabled
--fragment false
--header ignore
--hexliteralcase uppercase
--ifdef indent
--importgrouping alphabetized
--indent 4
--linebreaks lf

--patternlet hoist
--nospaceoperators
--self remove
--selfrequired
--stripunusedargs closure-only
--trailingclosures
--trimwhitespace always
--wraparguments before-first
--wrapcollections before-first
--xcodeindentation enabled
--disable redundantReturn, wrapMultilineStatementBraces
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- SwiftFormat/CLI (0.47.2)
- TableViewContent (3.0.2)
- TableViewContent (5.0.0)

DEPENDENCIES:
- SwiftFormat/CLI
Expand All @@ -16,7 +16,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
SwiftFormat: 0315a7115b15fd4ea2d043d5f5c22e3c98f84078
TableViewContent: c14053186a1579cb9dbfe1173383e1ae75caf48b
TableViewContent: de4ea2c1a0c0526a01cd18f8de0e5891e07ada69

PODFILE CHECKSUM: 35a8be3893318873897612545b5fea602dc5ba4d

Expand Down
4 changes: 4 additions & 0 deletions Example/TableViewContent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
E90279612553DB300076246D /* CustomHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E90279602553DB300076246D /* CustomHeaderView.xib */; };
E94A52C3216BBD440074BF82 /* CustomRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94A52C1216BBD440074BF82 /* CustomRow.swift */; };
E94A52C4216BBD440074BF82 /* CustomTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E94A52C2216BBD440074BF82 /* CustomTableViewCell.xib */; };
E9EECF1D256DA9E200606D3E /* ColorHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9EECF1C256DA9E200606D3E /* ColorHeaderView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -53,6 +54,7 @@
E90279602553DB300076246D /* CustomHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CustomHeaderView.xib; sourceTree = "<group>"; };
E94A52C1216BBD440074BF82 /* CustomRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRow.swift; sourceTree = "<group>"; };
E94A52C2216BBD440074BF82 /* CustomTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CustomTableViewCell.xib; sourceTree = "<group>"; };
E9EECF1C256DA9E200606D3E /* ColorHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorHeaderView.swift; sourceTree = "<group>"; };
F1D0D8B5537BDF9787B774A8 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
FC47E3A09CA4830F57C9306C /* TableViewContent.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = TableViewContent.podspec; path = ../TableViewContent.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -114,6 +116,7 @@
children = (
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
607FACD71AFB9204008FA782 /* ViewController.swift */,
E9EECF1C256DA9E200606D3E /* ColorHeaderView.swift */,
E94A52C1216BBD440074BF82 /* CustomRow.swift */,
E94A52C2216BBD440074BF82 /* CustomTableViewCell.xib */,
607FACD91AFB9204008FA782 /* Main.storyboard */,
Expand Down Expand Up @@ -366,6 +369,7 @@
E94A52C3216BBD440074BF82 /* CustomRow.swift in Sources */,
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
E9EECF1D256DA9E200606D3E /* ColorHeaderView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
31 changes: 31 additions & 0 deletions Example/TableViewContent/ColorHeaderView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// ColorHeaderView.swift
// TableViewContent_Example
//
// Created by Akira Matsuda on 2020/11/25.
// Copyright © 2020 CocoaPods. All rights reserved.
//

import TableViewContent
import UIKit

class ColorHeaderView: UIView, SectionConfigurable {
init(height: CGFloat) {
super.init(frame: .zero)
NSLayoutConstraint.activate([
heightAnchor.constraint(equalToConstant: height)
])
}

@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func configure(_ data: Any) {
guard let color = data as? UIColor else {
return
}
backgroundColor = color
}
}
33 changes: 26 additions & 7 deletions Example/TableViewContent/CustomRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,37 @@ import TableViewContent
import UIKit

class CustomTableViewCell: UITableViewCell {
@IBOutlet var button: UIButton!
public typealias Action = () -> Void

@IBOutlet private var button: UIButton!
var buttonPressedAction: Action = {}

override func awakeFromNib() {
super.awakeFromNib()
button.addTarget(self, action: #selector(buttonPressed(_:)), for: .touchUpInside)
}

@objc
private func buttonPressed(_: UIButton) {
buttonPressedAction()
}
}

class CustomRow: RowRepresentation {
class CustomRow: Row<CustomTableViewCell> {
public typealias Action = () -> Void

private var buttonPressedAction: Action = {}

init() {
super.init(nib: UINib(nibName: "CustomTableViewCell", bundle: nil), cellType: CustomTableViewCell.self, reuseIdentifier: "CustomTableViewCell", data: nil)
configure(CustomTableViewCell.self) { [unowned self] cell, _, _ in
cell.button.addTarget(self, action: #selector(self.buttonPressed), for: .touchUpInside)
}
super.init(
.nib(.init(nibName: "CustomTableViewCell", bundle: nil)),
reuseIdentifier: NSStringFromClass(CustomTableViewCell.self)
)
selectionStyle(.none)
}

override func defaultCellConfiguration(_ cell: CustomTableViewCell, _ indexPath: IndexPath) {
cell.buttonPressedAction = buttonPressedAction
}

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

@objc private func buttonPressed() {
@objc
private func buttonPressed() {
buttonPressedAction()
}
}
10 changes: 5 additions & 5 deletions Example/TableViewContent/CustomTableViewCell.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -18,15 +18,15 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VFu-v5-Enw">
<rect key="frame" x="118" y="6" width="84" height="30.5"/>
<rect key="frame" x="8" y="6" width="304" height="30.5"/>
<state key="normal" title="Custom Cell"/>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="VFu-v5-Enw" secondAttribute="bottom" constant="7.5" id="I9O-1c-13d"/>
<constraint firstItem="VFu-v5-Enw" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="IOW-2u-sUe"/>
<constraint firstAttribute="trailing" secondItem="VFu-v5-Enw" secondAttribute="trailing" constant="118" id="bJj-Md-dAa"/>
<constraint firstItem="VFu-v5-Enw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="118" id="gE0-ze-zfA"/>
<constraint firstAttribute="trailing" secondItem="VFu-v5-Enw" secondAttribute="trailing" constant="8" id="MlE-9F-d23"/>
<constraint firstItem="VFu-v5-Enw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="8" id="dJf-Qi-eKW"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
Expand Down
Loading

0 comments on commit bcf2d37

Please sign in to comment.