# Your Second iOS and SwiftUI App · Binding | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521>\
**Category:** 🎓 Courses & Articles\
**Created:** [October 10, 2019, 8:44am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521 "2019-10-10T08:44:59Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![t11s](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/t11s/32/88562_2.png) [@t11s](https://forums.kodeco.com/u/t11s)\
**Post date:** [March 5, 2020, 6:00am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/22 "2020-03-05T06:00:52Z")

</div>

@jessycatterwaul Thanks for your prompt response! You clarified a lot for me but I am still confused on my experiment to pass down a “task class” and edit it. When I do this in the “RowView.swift file” like so:

```swift
	struct RowView: View {

	var task: Task

	var body: some View {
		Button(action: { self.task.name = "This new name should be shown but is not!" }) {
			Text(task.name).strikethrough(task.completed)
		}

	}
}

```

The new name is not updated in the list. It will be however, if I open the the NewTaskView, which forces a re-render.

I don’t understand how ObservedObject can listen to the appending of the array (without a binding), but cannot listen to the change of a reference type’s property in that array.

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [March 5, 2020, 9:24am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/23 "2020-03-05T09:24:16Z")

</div>

> [@t11s](#):
>
> It will be however, if I open the the NewTaskView, which forces a re-render.

Are you using the 11.4 beta? That’s not the behavior I get. Only the new rows re-render.

In order to see what you’re seeing, I need to change the Identifiable behavior of `Task`. Again, this is all subject to change. Don’t put any faith in SwiftUI magically working, when there are ways to force it to work.

> [@t11s](#):
>
> I don’t understand how ObservedObject can listen to the appending of the array (without a binding), but cannot listen to the change of a reference type’s property in that array.

Arrays are value types. `@Published` is just a shortcut to calling [objectWillChange](https://developer.apple.com/documentation/combine/observableobject/3362556-objectwillchange) in the array’s `willSet` observer (with some async magic to make it more like `didSet`).

---

<div class="post-metadata">

**Author:** ![t11s](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/t11s/32/88562_2.png) [@t11s](https://forums.kodeco.com/u/t11s)\
**Post date:** [March 5, 2020, 7:27pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/24 "2020-03-05T19:27:10Z")

</div>

> [@jessycatterwaul](#):
>
> In order to see what you’re seeing, I need to change the Identifiable behavior of `Task` .

@jessycatterwaul Maybe this is because I’m displaying RowViews like this?

```auto
ForEach(
  Array( taskStore.tasks.enumerated() ),
  id: \.element.id
) { index, _ in
  RowView(task: self.taskStore.tasks[index])
}

```

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [March 5, 2020, 10:07pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/25 "2020-03-05T22:07:09Z")

</div>

I wouldn’t think that would result in anything different. You’re still using the same `id`. I don’t know what the rest of your project looks exactly like, though.

---

<div class="post-metadata">

**Author:** ![t11s](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/t11s/32/88562_2.png) [@t11s](https://forums.kodeco.com/u/t11s)\
**Post date:** [March 5, 2020, 11:59pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/26 "2020-03-05T23:59:29Z")

</div>

@jessycatterwaul Maybe my `Task.swift` is the problem?

```swift

import Foundation

class Task: Identifiable {
	let id = UUID()

	var name: String
	var completed: Bool = false

	init(name: String) {
		self.name = name
	}
}

```

**I just want to understand why changing a Task class doesn’t cause the row to be updated, but appending to the task list does?**

---

<div class="post-metadata">

**Author:** ![t11s](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/t11s/32/88562_2.png) [@t11s](https://forums.kodeco.com/u/t11s)\
**Post date:** [March 6, 2020, 4:49am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/27 "2020-03-06T04:49:39Z")

</div>

I think I may understand why it’s not updating when the class gets updated. As this StackOverflow post explains: [Why is an ObservedObject array not updated in my SwiftUI application? - Stack Overflow](https://stackoverflow.com/questions/57459727/why-an-observedobject-array-is-not-updated-in-my-swiftui-application).

“Since classes are references the array remains unchanged and so nothing is emitted by the subject.”

Does this sound correct to you?

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [March 6, 2020, 6:04am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/28 "2020-03-06T06:04:27Z")

</div>

Yes! 👍

That’s why I mentioned above that Swift Arrays are value types. I didn’t realize that you didn’t know about what you found at that link, which is the converse of that. If you reassign a reference in an Array, that’s a mutation of the Array. But if you mutate any property of a reference in an Array, it’s not.

More on this here. Let me know if you think there’s anything missing that we don’t cover, which would have helped you. (I realize the third link is after this course, in the learning path.)

- [https://www.raywenderlich.com/5539282-programming-in-swift-fundamentals/lessons/38](https://www.raywenderlich.com/5539282-programming-in-swift-fundamentals/lessons/38)
- [https://www.raywenderlich.com/5539282-programming-in-swift-fundamentals/lessons/40](https://www.raywenderlich.com/5539282-programming-in-swift-fundamentals/lessons/40)
- [https://www.raywenderlich.com/5429279-programming-in-swift-functions-and-types/lessons/33](https://www.raywenderlich.com/5429279-programming-in-swift-functions-and-types/lessons/33)

---

<div class="post-metadata">

**Author:** ![jbuegler](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jbuegler/32/81494_2.png) [@jbuegler](https://forums.kodeco.com/u/jbuegler)\
**Post date:** [April 27, 2020, 7:17am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/30 "2020-04-27T07:17:08Z")

</div>

I have a question to a bug I found.

When I add a Task and after adding immediately I try to use the Edit Button, the Rows don’t change to the edit mode. A weird fading happens.

What could be the reason? It happens also with the code for this course if I download it.

Thank you

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [April 27, 2020, 4:05pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/31 "2020-04-27T16:05:40Z")

</div>

Hi!

I’d like to see a video of this “weird fading”. As you can see in the comments for most of the videos, all of us are having an issue after adding a task, but I haven’t heard about fading yet!

---

<div class="post-metadata">

**Author:** ![jbuegler](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jbuegler/32/81494_2.png) [@jbuegler](https://forums.kodeco.com/u/jbuegler)\
**Post date:** [April 27, 2020, 7:37pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/32 "2020-04-27T19:37:19Z")

</div>

Hey Jessy,

thank you for the reply. Here is the video.

[https://www.dropbox.com/sh/ieefynicdv2j9t5/AACV9P2-p41BWYrVvVzp3Fj2a?dl=0](https://www.dropbox.com/sh/ieefynicdv2j9t5/AACV9P2-p41BWYrVvVzp3Fj2a?dl=0)

I couldn’t upload it here because I am still new.

I had the behavior in the simulator in my own app when using exactly your codes of the tutorial.

And here some error messages… maybe they help?

**2020-04-27 21:06:07.117449+0200 TaskList[1439:62793] -[\_UIRemoteKeyboards proxy]\_block\_invoke Failed to access remote service: Error Domain=NSCocoaErrorDomain Code=4099 “The connection to service on pid 1336 named com.apple.UIKit.KeyboardManagement.hosted was invalidated from this process.” UserInfo={NSDebugDescription=The connection to service on pid 1336 named com.apple.UIKit.KeyboardManagement.hosted was invalidated from this process.}**

**2020-04-27 21:06:07.126861+0200 TaskList[1439:57227] [Snapshotting] Snapshotting a view (0x7f8b36082600, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.**

Thank you a lot for looking into it.

Joern

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [April 27, 2020, 10:18pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/33 "2020-04-27T22:18:20Z")

</div>

Ah! I never looked at it in the canvas preview. That doesn’t happen in the Simulator or on-device. But what does happen, as others have noticed, is probably worse.

---

<div class="post-metadata">

**Author:** ![jbuegler](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jbuegler/32/81494_2.png) [@jbuegler](https://forums.kodeco.com/u/jbuegler)\
**Post date:** [April 28, 2020, 7:53am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/34 "2020-04-28T07:53:09Z")

</div>

Hey Jessy,

I also uploaded a video from the simulator. There is the same behavior as on the canvas.

[https://www.dropbox.com/s/eew4tvpltet7b2v/IMG\_0873.MOV?dl=0](https://www.dropbox.com/s/eew4tvpltet7b2v/IMG_0873.MOV?dl=0)

Is this behavior connected to the “known” problem?

So no solution so far?

Thank you very much for taking the time.

Joern

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [April 29, 2020, 5:34am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/35 "2020-04-29T05:34:51Z")

</div>

Interesting!

The rest of us who have commented aren’t seeing that outside of the canvas. Instead, we’re just getting lack of responsiveness.

No solution yet. Here’s hoping it’s less than a month and a half away. 🤞

---

<div class="post-metadata">

**Author:** ![drerucha](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/drerucha/32/89062_2.png) [@drerucha](https://forums.kodeco.com/u/drerucha)\
**Post date:** [May 3, 2020, 5:48am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/36 "2020-05-03T05:48:28Z")

</div>

I’m seeing the same crash:

`Fatal error: Index out of range: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.2.25.8/swift/stdlib/public/core/ContiguousArrayBuffer.swift, line 444`

I’m not using the extension. I’m using the simpler method recommended in the comments.

---

<div class="post-metadata">

**Author:** ![vgadkari](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/vgadkari/32/81494_2.png) [@vgadkari](https://forums.kodeco.com/u/vgadkari)\
**Post date:** [May 5, 2020, 8:55pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/37 "2020-05-05T20:55:19Z")

</div>

So when we want to make our own apps, do we have to have those kinds of extensions in our project? I didnt quite understand what purpose those extensions played. Why did the errors go away?

---

<div class="post-metadata">

**Author:** ![corey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/corey/32/81494_2.png) [@corey](https://forums.kodeco.com/u/corey)\
**Post date:** [May 6, 2020, 12:29am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/38 "2020-05-06T00:29:10Z")

</div>

> [@narutoog7](#):
>
> When I remove the .indices from taskStore.tasks in contentview, i get an error saying "Cannot convert value of type ‘[Task]’ to expected argument type ‘Range’ ". I have tried to figure this out myself, and even after recreating the project, I still got the same result.

I’m running into this same issue. Not sure what I’m doing wrong. I even download the materials and upload the files from the tracklist and still get this error. Any idea what could be wrong or how I can fix it to move on with the rest of the course.

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [May 6, 2020, 6:06am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/39 "2020-05-06T06:06:08Z")

</div>

> [@Your Second iOS and SwiftUI App · Binding | raywenderlich.com](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/15):
>
> I recommend using Git to find the exact differences between versions of a project. Are you familiar with it? If not, upload your version and I’ll let you know what it has to say! Also recommended! [https://www.raywenderlich.com/4418-beginning-git](https://www.raywenderlich.com/4418-beginning-git)[https://www.raywenderlich.com/4289-mastering-git](https://www.raywenderlich.com/4289-mastering-git)

---

<div class="post-metadata">

**Author:** ![krishnabpm](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/krishnabpm/32/81494_2.png) [@krishnabpm](https://forums.kodeco.com/u/krishnabpm)\
**Post date:** [May 23, 2020, 9:03am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/40 "2020-05-23T09:03:47Z")

</div>

Hi , How did you solve this crash. Even my app is crashing because of same issue. Something related t o arrays.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [July 6, 2020, 2:27am UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/41 "2020-07-06T02:27:41Z")

</div>

@krishnabpm Do you still have issues with this?

---

<div class="post-metadata">

**Author:** ![j\_k\_nash](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/j_k_nash/32/106313_2.png) [@j\_k\_nash](https://forums.kodeco.com/u/j_k_nash)\
**Post date:** [August 17, 2020, 8:39pm UTC](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521/42 "2020-08-17T20:39:42Z")

</div>

I found this a little bit Hard to follow, I’m guessing it’s because of the newness of swiftUi and the fact that you needed to go into this alternative way of doing things. I’m just going to keep going and not let it put me off

[Previous page](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521.md?page=1)

[Next page](https://forums.kodeco.com/t/your-second-ios-and-swiftui-app-binding-raywenderlich-com/84521.md?page=3)
