<html><body><div><br></div><div><br>Am 25. Februar 2016 um 21:13 schrieb Jean-Daniel Dupas via swift-evolution &lt;swift-evolution@swift.org&gt;:<br><br><div><blockquote type="cite"><div class="msg-quote" style="word-wrap: break-word;" data-mce-style="word-wrap: break-word;"><br class=""><div><blockquote type="cite" class=""><div class="">Le 25 févr. 2016 à 20:28, Matthew Johnson &lt;<a href="mailto:matthew@anandabits.com" class="" data-mce-href="mailto:matthew@anandabits.com">matthew@anandabits.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word;" class="" data-mce-style="word-wrap: break-word;">[...]<br class=""><div class=""><br class=""></div><div class="">It depends what you mean by “strong”. &nbsp;Sure, a log statement won’t make much difference. &nbsp;But the examples I gave do have semantic requirements that super should either go first or last in performing real work to be done by the method.</div></div></div></blockquote><br class=""></div><div>For instance:</div><div><pre style="white-space: pre-wrap; background-color: #ffffff;" class="" data-mce-style="white-space: pre-wrap; background-color: #ffffff;">// If you override this method, you must call super first to get the invalidation context object to return. After getting this object, set any custom properties and return it.
func invalidationContextForBoundsChange(_ newBounds: CGRect) -&gt; UICollectionViewLayoutInvalidationContext</pre><div class=""><br class=""></div><div class="">Why must I call super first ? Why can’t I don’t a bunch of things that are related to my subclass first ?</div><div class=""><br class=""></div><div class="">How am I supposed to do if I want to compute a new bound to pass to super instead of forwarding it naively.</div><div class=""><br class=""></div><div class="">ditto for&nbsp;</div><div class=""><pre style="white-space: pre-wrap; background-color: #ffffff;" class="" data-mce-style="white-space: pre-wrap; background-color: #ffffff;">// call super first to retrieve the item’s existing attributes and then make your changes to the returned structure.
layoutAttributesForInteractivelyMovingItemAtIndexPath(_ indexPath: NSIndexPath, withTargetPosition position: CGPoint) -&gt; UICollectionViewLayoutAttributes</pre><div class="">Why would you prevent a subclass to compute an other indexPath or target position before calling super ?</div></div></div></div></blockquote></div><div><span><br data-mce-bogus="1"></span></div><div><span>+1<br data-mce-bogus="1"></span></div><div><span><br data-mce-bogus="1"></span></div><div><span>These are excellent examples demonstrating why enforcing super(first/last) is too restrictive.<br data-mce-bogus="1"></span></div><div><span><br data-mce-bogus="1"></span></div><div><span>-Thorsten<br data-mce-bogus="1"></span></div><div><span><br data-mce-bogus="1"></span></div><div><span>&nbsp;</span></div></div></body></html>