Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xx messenger iOS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
iOS
xx messenger iOS
Commits
1186a3cb
Commit
1186a3cb
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Refactor
parent
9d77239c
No related branches found
No related tags found
2 merge requests
!54
Releasing 1.1.4
,
!51
CollectionView library
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/CollectionView/CellFactory.swift
+13
-5
13 additions, 5 deletions
Sources/CollectionView/CellFactory.swift
with
13 additions
and
5 deletions
Sources/CollectionView/CellFactory.swift
+
13
−
5
View file @
1186a3cb
...
...
@@ -2,6 +2,10 @@ import UIKit
public
struct
CellFactory
<
Model
>
{
public
struct
Registrar
{
public
init
(
register
:
@escaping
(
UICollectionView
)
->
Void
)
{
self
.
register
=
register
}
public
var
register
:
(
UICollectionView
)
->
Void
public
func
callAsFunction
(
in
view
:
UICollectionView
)
{
...
...
@@ -10,20 +14,21 @@ public struct CellFactory<Model> {
}
public
struct
Builder
{
public
var
buildCell
:
(
Model
,
UICollectionView
,
IndexPath
)
->
UICollectionViewCell
?
public
init
(
build
:
@escaping
(
Model
,
UICollectionView
,
IndexPath
)
->
UICollectionViewCell
?)
{
self
.
build
=
build
}
public
var
build
:
(
Model
,
UICollectionView
,
IndexPath
)
->
UICollectionViewCell
?
public
func
callAsFunction
(
for
model
:
Model
,
in
view
:
UICollectionView
,
at
indexPath
:
IndexPath
)
->
UICollectionViewCell
?
{
build
Cell
(
model
,
view
,
indexPath
)
build
(
model
,
view
,
indexPath
)
}
}
public
var
register
:
Registrar
public
var
build
:
Builder
public
init
(
register
:
Registrar
,
build
:
Builder
...
...
@@ -31,6 +36,9 @@ public struct CellFactory<Model> {
self
.
register
=
register
self
.
build
=
build
}
public
var
register
:
Registrar
public
var
build
:
Builder
}
extension
CellFactory
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment