Comments (4)
Hmm the demo app even adds removes sections without issue. Which wouldn’t be possible if the updateDelegate wasn’t set.
from composed.
Hmm the demo app even adds removes sections without issue. Which wouldn’t be possible if the updateDelegate wasn’t set.
Looking at the demo the delegate is set to an instance of SectionProviderMapping
but I can't find where that's done.
I think I got confused about what it was embedded in. For example I have:
ComposedSectionProvider
ComposedSectionProvider
ComposedSectionProvider
SingleElementSection
SegmentedSectionProvider
Section
Changes made to the Section
are not propagated and the delegate is nil
, maybe this is actually an issue with SegmentedSectionProvider
.
Edit
Making PeopleComposedSectionProvider
a SegmentedSectionProvider
and updating the insert to:
var newIndex = 0
func append() {
append(peopleSection())
self.currentIndex = newIndex
newIndex += 1
}
causes new inserts to not be shown after inserting a second section. A breakpoint at https://github.com/composed-swift/Composed-Demo/blob/master/Composed-Demo/Sections/PeopleSection+Editing.swift#L37 shows that updateDelegate
is nil
.
I can't figure out exactly how it should work but here's a test that I think should pass but doesn't:
import Quick
import Nimble
@testable import Composed
final class SegmentedSectionProvider_Spec: QuickSpec {
override func spec() {
describe("SegmentedSectionProvider") {
var global: SegmentedSectionProvider!
var mapping: SectionProviderMapping!
var child1: ComposedSectionProvider!
var child2: ArraySection<String>!
beforeEach {
global = SegmentedSectionProvider()
mapping = SectionProviderMapping(provider: global)
child1 = ComposedSectionProvider()
let child1a = ArraySection<String>()
let child1b = ArraySection<String>()
child2 = ArraySection<String>()
global.append(child1)
global.append(child2)
child1.append(child1a)
child1.append(child1b)
}
context("after changing the `currentIndex") {
beforeEach {
global.currentIndex = 1
}
it("should unset the delegate of the previous child") {
expect(child1.updateDelegate).to(beNil())
}
it("should set the delegate of the current child") {
expect(child2.updateDelegate).toNot(beNil()) // Fails
}
}
context("without changing the `currentIndex`") {
it("should set the delegate") {
expect(child1.updateDelegate).toNot(beNil()) // Fails
}
it("should not set the delegate of children") {
expect(child2.updateDelegate).to(beNil())
}
}
}
}
}
from composed.
I will review this soon and get back to you.
from composed.
This has been resolved and included in release v1.0.3
from composed.
Related Issues (10)
- Project is unlicenced HOT 3
- Adding `Suspendible` support HOT 8
- [BUG] HOT 1
- Improve extensions for RandomAccessCollection HOT 5
- Merge Composed, ComposedUI, and ComposedLayouts packages HOT 14
- `CollectionCoordinatorDelegate`'s background view does not behave as documented HOT 9
- Crash when update occurs as side effect of view configuration HOT 2
- Implement Drag and Drop API support HOT 1
- Implement reordering API 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 composed.