<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">&lt;<a href="mailto:rmann@latencyzero.com" target="_blank">rmann@latencyzero.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yeah, that&#39;s not it. I made the change you suggested, I get the same error.<br>
<span class="im HOEnZb"><br>
&gt; On Sep 13, 2017, at 18:11 , Zhao Xin &lt;<a href="mailto:owenzx@gmail.com">owenzx@gmail.com</a>&gt; wrote:<br>
&gt;<br>
</span><div class="HOEnZb"><div class="h5">&gt; Change `self` to `ModelFetcher`. You are calling a class static property, not a class instance property.<br>
&gt;<br>
&gt; Zhao Xin<br>
&gt;<br>
&gt; On Thu, Sep 14, 2017 at 8:37 AM, Rick Mann via swift-users &lt;<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>&gt; wrote:<br>
&gt; Moving to Swift 4, I&#39;m running into an issue for which I can&#39;t seem to find an answer in google:<br>
&gt;<br>
&gt; &quot;Cannot use mutating member on immutable value: &#39;self&#39; is immutable&quot;<br>
&gt;<br>
&gt; The code looks like:<br>
&gt;<br>
&gt; class<br>
&gt; ModelFetcher : NSObject, URLSessionDelegate<br>
&gt; {<br>
&gt;     ...<br>
&gt;     static  let     managerDispatchQueue                    =   DispatchQueue(label: &quot;Model Download Manager Queue&quot;)<br>
&gt;     static  var     pendingFetchers                         =   [ModelFetcher]()<br>
&gt;     static  var     currentFetcher:         ModelFetcher?<br>
&gt;<br>
&gt;     class<br>
&gt;     func<br>
&gt;     startNextFetcher()<br>
&gt;     {<br>
&gt;         self.managerDispatchQueue.<wbr>async<br>
&gt;         {<br>
&gt;             guard<br>
&gt;                 self.currentFetcher == nil,<br>
&gt;                 let mf = self.pendingFetchers.popFirst(<wbr>)<br>
&gt;                          ~~~~ ^                             error: cannot use mutating member on immutable value: &#39;self&#39; is immutable<br>
&gt;             else<br>
&gt;             {<br>
&gt;                 return<br>
&gt;             }<br>
&gt;<br>
&gt;             self.currentFetcher = mf<br>
&gt;             mf.start()<br>
&gt;         }<br>
&gt;     }<br>
&gt;     ...<br>
&gt; }<br>
&gt;<br>
&gt; 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. &quot;self.currentFetcher = nil&quot; or &quot;self.pendingFetchers.remove(<wbr>at: idx)&quot;). Not sure what&#39;s special about this one.<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Rick Mann<br>
&gt; <a href="mailto:rmann@latencyzero.com">rmann@latencyzero.com</a><br>
&gt;<br>
&gt;<br>
&gt; ______________________________<wbr>_________________<br>
&gt; swift-users mailing list<br>
&gt; <a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
&gt; <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>
&gt;<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>