Dec 21, 2023 11:32
Anyways I appreciate your time very much, will make sure I spread the knowledge with my team. Best of luck and happy holidays ( :
Dec 21, 2023 11:32
We hear everywhere about task trees and so on but then Task created with init inside another task is not a child of its parent? Task created with async let (that the user has no notion of) however is a child of its parent - Its very confusing and in my opinion the Swift team has made redundant syntax sugars which are cool to show off in WWDC but are hard to understand when you start working with them
Dec 21, 2023 11:30
I have read a few books and numerous articles and I can see there is this cloud of confusion everywhere on how things work and how we should be using them. WWDC is super vague, the proposals are very detailed with theory that a normal user has difficult time processing it.
Dec 21, 2023 11:21
The fact that a task created with .init inherits the actor context of the caller DOES NOT and WILL NOT mean that the task is a child of 'some-up-the-stack' potential parent task.
Dec 21, 2023 11:20
When we talk about structured concurrency we talk about a tree of tasks. When we talk about creating a new task with init we talk about inheriting actor context.
Dec 21, 2023 11:20
I guess the most important thing for me from this thread as you've outlined a few times is that a task being a child of another (that is achieved by async let or taskGroup) is a different concept from what the documentation says about Task - "the task created by Task.init(priority:operation:) inherits the priority and actor context of the caller".
Dec 21, 2023 09:20
You can create another task in task using Task.init or Task.detached. - Yeah but why would one do that ? Given all we've said so far do you have a concrete example when one would to that - to me it sounds like an antipattern
Dec 21, 2023 09:20
Thank you so much for the explanations. This is extremely helpful for my understanding
Dec 20, 2023 18:46
Furthermore in the reference about Task it is stated "To support operations on the current task, which can be either a detached task or child task, Task also exposes class methods like yield(). Because these methods are asynchronous, they’re always invoked as part of an existing task." - "support operations on the current task ... which can be child task" -> given that we said that a child task is one implicitly created with async let or task group - how do I even make operation on a child task?
Dec 20, 2023 18:18
On the same topic - I keep seeing examples where we create a Task inside an async function and I don't get it - creating a Task (unstructured concurrency) should be happening only in sync functions right ?
Dec 20, 2023 17:46
Following from here stackoverflow.com/a/71577170/483375 can I safely assume that when we talk about child task this is the implicit creation (user has no notion of Task creation at this point) of task when using async let or a task group - are there other cases that can create a child task ?
Dec 20, 2023 17:44
So here comes my confusion after reading a few books and numerous articles on the topic - What exactly do we mean when we say "async context" ? Is this the Sendable closure used in the Task initializer, is this the magical place where actor isolation happens in ?
Dec 20, 2023 17:43
The key point, not too much discussed anywhere, is the fact that child task and async context inheritance are two separate topics.
Dec 20, 2023 17:41
async let = is a structured concurrency, it does not inherit actor async context. I also wrote Detached tasks Task.detached, async let = tasks, group tasks do NOT inherit actor async context.
Dec 20, 2023 17:41
```
Dec 20, 2023 17:37
You say
Dec 20, 2023 17:37
Thanks for reaching out
Dec 20, 2023 17:37
Hey
 
Dec 18, 2023 12:30
Oh well, I think I managed to answer my question. The fact that we have @ObservedObject in a view means that the view will be implicitly isolated to the MainActor due to "A struct or class containing a wrapped instance property with a global actor-qualified wrappedValue infers actor isolation from that property wrapper:
" from: https://github.com/apple/swift-evolution/blob/main/proposals/0316-global-actors.md
Dec 18, 2023 12:08
The code above will result in serial execution of the tasks, and the only difference is the presence of a @ObjservedObject in the view which is not used.
Dec 18, 2023 12:08
```
let poi = OSLog(subsystem: "Test", category: .pointsOfInterest)

class DummyVC: ObservableObject {}

struct ContentView: View {
    @ObservedObject var dummy = DummyVC()

    var body: some View {
        VStack {
            Button("Launch Ten Tasks") {
                launchTenTasks()
            }
        }
        .padding()
    }

    func launchTenTasks() {
        let experiment = Experiment()

        for i in 0 ..< 10 {
            Task {
                experiment.spin(index: i, for: 1)
Dec 18, 2023 12:06
```
Dec 18, 2023 12:04
Thank you so much for detailed examples @Rob. What I meant to say with my message "I can see that execution is not concurrent but parallel" was instead "I can see that execution is not concurrent but serial"
 

[iOS][Android][ChaosOverFlow]

Join to become part of the community, not to simply ask questi...
Nov 5, 2014 14:17
doesnt work
Nov 5, 2014 14:17
this is what i tried
Nov 5, 2014 14:17
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.blueView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]];
Nov 5, 2014 14:16
i know the principle - but i dont understand which constrainst exactly are needed and have to be animated
Nov 5, 2014 14:16
a link pls ?
Nov 5, 2014 14:15
Anyone have a clue on how to do this ?
Nov 5, 2014 14:15
Hey, I am trying to do some animation with autolayout. I am trying to have a view slide out from the right to the left and disappear from the screen.
Nov 4, 2014 15:42
but it doesnt seem to work
Nov 4, 2014 15:42
i tried this : [NSLayoutConstraint constraintWithItem:drawerView
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:self.drawerMenuVC.tapView
attribute:NSLayoutAttributeHeight
multiplier:1.0
constant:0]
Nov 4, 2014 15:42
can someone explain to me how is this translated in the api - constraintsWithVisualFormat:@"V:|[drawerView(==tapView)]|" ?
Nov 4, 2014 15:42
hi
Oct 10, 2014 10:54
I was wondering if anyone can point me in the right direction of the following problem: I need to have the server update my app at some point. However, APNS is not reliable way since it does not guarantee delivery. What options are there if data must be updated not-so-often maybe once a day?
Oct 10, 2014 10:52
Hey guys
 

NSChat

Rules → spiff.io/nschat.rules —  Discussion for iOS and OS X ...
Nov 4, 2014 16:02
still doesnt answer my question though
Nov 4, 2014 16:02
thanks will do
Nov 4, 2014 16:01
no
Nov 4, 2014 16:00
since I need to parameterise the constraint - so I can change it later
Nov 4, 2014 16:00
i wonder how to do the same thing using the API
Nov 4, 2014 16:00
@"V:|[drawerView(==tapView)]|" -> that just states that the 2 views have equal height right ?
Nov 4, 2014 15:59
ok
Nov 4, 2014 15:53
Can someone explain to me how is this translated in the api - constraintsWithVisualFormat:@"V:|[drawerView(==tapView)]|" ?
i tried this : [NSLayoutConstraint constraintWithItem:drawerView
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:self.drawerMenuVC.tapView
attribute:NSLayoutAttributeHeight
multiplier:1.0
constant:0]
but it doesnt seem to work
Nov 4, 2014 15:52
hi all
 
Oct 8, 2014 11:32
how can i find out what is causing the tableview to reload ? I have a symbolic point on -[UITableView reloadData] but it does not get called
Oct 8, 2014 11:26
what might be causing the table view reloading only on iOS 8 ? Could it be something related to the scrollview offset and stuff ?
Oct 8, 2014 11:22
its weird because the tableview does not get reloaded in iOS 7 and the delegates are not called
Oct 8, 2014 11:21
no
Oct 8, 2014 11:17
Hi everyone. I am experiencing a strange behaviour. On iOS 8, after a modal view controller is dismissed, my tableView delegate methods are getting called to reload the table view. This does not happen on iOS 7. Anyone might have a clue about this ? What might have been changed in iOS 8 ?