<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">I begin to think it is related to how you `<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">popFirst(</span><wbr style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">)` implemented. Check it or post it here.</span></div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px"><br></span></div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">Zhao Xin</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 14, 2017 at 9:36 AM, Roderick Mann <span dir="ltr"><<a href="mailto:rmann@latencyzero.com" target="_blank">rmann@latencyzero.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yeah, that's not it. I made the change you suggested, I get the same error.<br>
<span class="im HOEnZb"><br>
> On Sep 13, 2017, at 18:11 , Zhao Xin <<a href="mailto:owenzx@gmail.com">owenzx@gmail.com</a>> wrote:<br>
><br>
</span><div class="HOEnZb"><div class="h5">> Change `self` to `ModelFetcher`. You are calling a class static property, not a class instance property.<br>
><br>
> Zhao Xin<br>
><br>
> On Thu, Sep 14, 2017 at 8:37 AM, Rick Mann via swift-users <<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br>
> Moving to Swift 4, I'm running into an issue for which I can't seem to find an answer in google:<br>
><br>
> "Cannot use mutating member on immutable value: 'self' is immutable"<br>
><br>
> The code looks like:<br>
><br>
> class<br>
> ModelFetcher : NSObject, URLSessionDelegate<br>
> {<br>
> ...<br>
> static let managerDispatchQueue = DispatchQueue(label: "Model Download Manager Queue")<br>
> static var pendingFetchers = [ModelFetcher]()<br>
> static var currentFetcher: ModelFetcher?<br>
><br>
> class<br>
> func<br>
> startNextFetcher()<br>
> {<br>
> self.managerDispatchQueue.<wbr>async<br>
> {<br>
> guard<br>
> self.currentFetcher == nil,<br>
> let mf = self.pendingFetchers.popFirst(<wbr>)<br>
> ~~~~ ^ error: cannot use mutating member on immutable value: 'self' is immutable<br>
> else<br>
> {<br>
> return<br>
> }<br>
><br>
> self.currentFetcher = mf<br>
> mf.start()<br>
> }<br>
> }<br>
> ...<br>
> }<br>
><br>
> This code compiled fine in Xcode 8, or in Xcode 9/Swift 3.2 as a monolithic app (the error shows up when this code is factored into a framework). Other mutating references to self seem to compile okay (e.g. "self.currentFetcher = nil" or "self.pendingFetchers.remove(<wbr>at: idx)"). Not sure what's special about this one.<br>
><br>
><br>
> --<br>
> Rick Mann<br>
> <a href="mailto:rmann@latencyzero.com">rmann@latencyzero.com</a><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> swift-users mailing list<br>
> <a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
><br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Rick Mann<br>
<a href="mailto:rmann@latencyzero.com">rmann@latencyzero.com</a><br>
<br>
<br>
</font></span></blockquote></div><br></div>