Skip to content

Commit 6fc5df2

Browse files
committed
Merge branch 'develop'
2 parents 09b20c3 + f7d8e2a commit 6fc5df2

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

Example/LXFProtocolTool.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
FD97E0DF214B5CFE0057C3C1 /* LXFFullScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD97E0DE214B5CFE0057C3C1 /* LXFFullScreenView.swift */; };
4040
FD9E556A2261F88A00921471 /* LXFDIYHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9E55692261F88A00921471 /* LXFDIYHeader.swift */; };
4141
FD9E556C2261FD0B00921471 /* LXFDIYAutoFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9E556B2261FD0B00921471 /* LXFDIYAutoFooter.swift */; };
42+
FDA19600271F0F5E00226AF5 /* LXFDIYTrailer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDA195FF271F0F5E00226AF5 /* LXFDIYTrailer.swift */; };
4243
FDCE664226A2C6CC00B49BE3 /* LXFRefreshableTrailerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDCE664126A2C6CC00B49BE3 /* LXFRefreshableTrailerController.swift */; };
4344
FDCE664526A2C7B300B49BE3 /* LXFRefreshableTrailerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDCE664426A2C7B300B49BE3 /* LXFRefreshableTrailerCell.swift */; };
4445
FDCE664B26A2D9D500B49BE3 /* LXFRefreshableTrailerReactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDCE664A26A2D9D500B49BE3 /* LXFRefreshableTrailerReactor.swift */; };
@@ -100,6 +101,7 @@
100101
FD97E0DE214B5CFE0057C3C1 /* LXFFullScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFFullScreenView.swift; sourceTree = "<group>"; };
101102
FD9E55692261F88A00921471 /* LXFDIYHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFDIYHeader.swift; sourceTree = "<group>"; };
102103
FD9E556B2261FD0B00921471 /* LXFDIYAutoFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFDIYAutoFooter.swift; sourceTree = "<group>"; };
104+
FDA195FF271F0F5E00226AF5 /* LXFDIYTrailer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFDIYTrailer.swift; sourceTree = "<group>"; };
103105
FDCE664126A2C6CC00B49BE3 /* LXFRefreshableTrailerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFRefreshableTrailerController.swift; sourceTree = "<group>"; };
104106
FDCE664426A2C7B300B49BE3 /* LXFRefreshableTrailerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFRefreshableTrailerCell.swift; sourceTree = "<group>"; };
105107
FDCE664A26A2D9D500B49BE3 /* LXFRefreshableTrailerReactor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LXFRefreshableTrailerReactor.swift; sourceTree = "<group>"; };
@@ -378,6 +380,14 @@
378380
path = DIY;
379381
sourceTree = "<group>";
380382
};
383+
FDA195FE271F0F4E00226AF5 /* DIY */ = {
384+
isa = PBXGroup;
385+
children = (
386+
FDA195FF271F0F5E00226AF5 /* LXFDIYTrailer.swift */,
387+
);
388+
path = DIY;
389+
sourceTree = "<group>";
390+
};
381391
FDCE664026A2C68900B49BE3 /* LXFRefreshable-Trailer */ = {
382392
isa = PBXGroup;
383393
children = (
@@ -391,6 +401,7 @@
391401
FDCE664326A2C7A000B49BE3 /* View */ = {
392402
isa = PBXGroup;
393403
children = (
404+
FDA195FE271F0F4E00226AF5 /* DIY */,
394405
FDCE664426A2C7B300B49BE3 /* LXFRefreshableTrailerCell.swift */,
395406
);
396407
path = View;
@@ -611,6 +622,7 @@
611622
FD97E0DF214B5CFE0057C3C1 /* LXFFullScreenView.swift in Sources */,
612623
FD5152A82111952F00A8591F /* LXFRefreshableSection.swift in Sources */,
613624
FD9E556A2261F88A00921471 /* LXFDIYHeader.swift in Sources */,
625+
FDA19600271F0F5E00226AF5 /* LXFDIYTrailer.swift in Sources */,
614626
BD98FF7E26E20F6F00153E1A /* LXFEquatableViewController.swift in Sources */,
615627
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
616628
FD5152AF21119A7800A8591F /* LXFRefreshableCell.swift in Sources */,

Example/LXFProtocolTool/Demo/LXFRefreshable/LXFRefreshable-Trailer/LXFRefreshableTrailerController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class LXFRefreshableTrailerController: UIViewController, View, Refreshable {
8989
.disposed(by: disposeBag)
9090

9191
// self.rx.trailerRefresh(reactor, self.listView, trailerConfig: RefreshTrailerConfig.normal)
92+
// self.rx.trailerRefresh(reactor, self.listView, trailerConfig: RefreshTrailerConfig.diy)
9293
self.rx.trailerRefresh(reactor, self.listView)
9394
.map { .fetchList(false) }
9495
.bind(to: reactor.action)
@@ -107,4 +108,6 @@ struct RefreshTrailerConfig {
107108
stateColor: .systemBlue,
108109
hideArrowView: true
109110
)
111+
112+
static let diy = RefreshableTrailerConfig(type: .diy(type: LXFDIYTrailer.self))
110113
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//
2+
// LXFDIYTrailer.swift
3+
// LXFProtocolTool_Example
4+
//
5+
// Created by LinXunFeng on 2021/10/19.
6+
// Copyright © 2021 CocoaPods. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import MJRefresh
11+
import UIKit
12+
13+
class LXFDIYTrailer: MJRefreshTrailer {
14+
15+
lazy var colorView: UIView = {
16+
let v = UIView()
17+
v.backgroundColor = .red
18+
return v
19+
}()
20+
21+
override var state: MJRefreshState {
22+
didSet {
23+
switch state {
24+
case .idle:
25+
self.colorView.backgroundColor = .red
26+
case .pulling:
27+
self.colorView.backgroundColor = .green
28+
case .refreshing:
29+
self.colorView.backgroundColor = .yellow
30+
default:
31+
break
32+
}
33+
}
34+
}
35+
36+
override func prepare() {
37+
super.prepare()
38+
39+
self.addSubview(self.colorView)
40+
}
41+
42+
override func placeSubviews() {
43+
super.placeSubviews()
44+
45+
// 设置宽度
46+
self.mj_w = 100
47+
self.colorView.frame = CGRect(x: 0, y: 0, width: 90, height: 50)
48+
}
49+
}
50+

LXFProtocolTool/Classes/Refreshable/Refreshable.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,8 @@ public extension LXFNameSpace where Base: Refreshable {
523523
normalTrailer.arrowView?.image = arrowViewImage
524524
}
525525
trailer = normalTrailer
526+
case let .diy(TrailerType):
527+
return TrailerType.init{ action() }
526528
}
527529

528530
trailer?.ignoredScrollViewContentInsetRight = config.ignoredScrollViewContentInsetRight
@@ -569,6 +571,7 @@ public enum RefreshFooterType {
569571

570572
public enum RefreshTrailerType {
571573
case normal
574+
case diy(type: MJRefreshTrailer.Type)
572575
}
573576

574577
public struct RefreshableHeaderConfig {
@@ -692,7 +695,7 @@ public struct RefreshableFooterConfig {
692695

693696
public struct RefreshableTrailerConfig {
694697
/// 类型
695-
var type : RefreshTrailerType
698+
var type : RefreshTrailerType = .normal
696699

697700
/// 忽略多少scrollView的contentInset的right
698701
var ignoredScrollViewContentInsetRight: CGFloat = 0

0 commit comments

Comments
 (0)