Comments (6)
You can simply access your controller via cell.controller.
from lbtacomponents.
I've been unable to import the ClassName "LBTAComponents" from Pods. I was successfully installed the LBTAComponents through Pods,bt it can't.
from lbtacomponents.
I am having the same trouble as the person who opened this issue and I do not know why this issue is closed when the problem has not been solved.
How can I iterate through the cells and set the delegate?
from lbtacomponents.
So I solved this by implementing this
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> CustomCell {
let cell: CustomCell
if let cls = datasource?.cellClass(indexPath) {
cell = collectionView.dequeueReusableCell(withReuseIdentifier: NSStringFromClass(cls), for: indexPath) as! DatasourceCell as! CustomCell
} else if let cellClasses = datasource?.cellClasses(), cellClasses.count > indexPath.section {
let cls = cellClasses[indexPath.section]
cell = collectionView.dequeueReusableCell(withReuseIdentifier: NSStringFromClass(cls), for: indexPath) as! DatasourceCell as! CustomCell
} else if let cls = datasource?.cellClasses().first {
cell = collectionView.dequeueReusableCell(withReuseIdentifier: NSStringFromClass(cls), for: indexPath) as! DatasourceCell as! CustomCell
} else {
cell = collectionView.dequeueReusableCell(withReuseIdentifier: defaultCellId, for: indexPath) as! DatasourceCell as! CustomCell
}
cell.delegate = self
cell.controller = self
cell.datasourceItem = datasource?.item(indexPath)
return cell
}
into my DatasourceController. Basically it's a copy from the LBTA framework with the cell.delegate = self added to it.
from lbtacomponents.
As you can see, each cell has a "controller" property which you can use as your delegate.
from lbtacomponents.
Sorry, I am relatively new to swift programing, but how exactly do I set the controller property as my delegate? There is no function that iterates through each cells in LBTAComponents's DatasourceController, right?
from lbtacomponents.
Related Issues (20)
- How to register Nib file ?
- Why extending UICollcetionViewController? HOT 7
- UIView not showing up HOT 1
- Can't Access files HOT 1
- how to assign optional contraints through anchors HOT 2
- Optional constraints HOT 1
- DatasourceControllerDelegate? HOT 1
- Type 'NSAttributedStringKey' (aka 'NSString') has no member 'paragraphStyle' HOT 2
- Dynamiclally change Datasource items number HOT 1
- Multiple API request on same datasource HOT 2
- VFL with Safe Area HOT 1
- Video tutorial playlist on YouTube
- No such module 'LBTAComponent' HOT 1
- Can't reload DataSourceCell from DataSourceContoller HOT 1
- Not running well under Swift 4 HOT 3
- Swift Problem? HOT 2
- Conversion to Swift 4.2 HOT 2
- Allow branch creation and pull requests? HOT 1
- Update to Swift 5 HOT 6
- UITextViews not rendering on LBTAFormController HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lbtacomponents.