<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font face="Avenir-Book" class="">I’d like to proposal to the Swift community and discuss the advantages and disadvantages of adding modifiable properties to extensions (in addition to the already existing computed properties, instance methods, subscripts, etc.):</font><div class=""><font face="Avenir-Book" class=""><br class=""></font></div><div class=""><font face="Avenir-Book" class="">extension SomeType {</font></div><div class=""><span class="Apple-tab-span" style="white-space:pre"><font face="Avenir-Book" class="">        </font></span></div><div class=""><font face="Avenir-Book" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var aNewProperty: Int</font></div><div class=""><font face="Avenir-Book" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var anotherVariable: String</font></div><div class=""><font face="Avenir-Book" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var aThirdOne: MyStruct</font></div><div class=""><font face="Avenir-Book" class=""><br class=""></font></div><div class=""><font face="Avenir-Book" class="">…</font></div><div class=""><font face="Avenir-Book" class=""><br class=""></font></div><div class=""><font face="Avenir-Book" class="">}</font></div><div class=""><font face="Avenir-Book" class=""><br class=""></font></div><div class=""><font face="Avenir-Book" class="">I have experienced many occasions where adding a a property to an extension would have resulted in cleaner code by keeping all similar code locally together in a file. <font color="#333333" class="">Not knowing much about language design, I don't know if this offering this might break some fundamental principal in OOP design. Curiously ObjC also had this limitation but apparently C# offers the capability in partial classes.</font></font></div><div class=""><span style="color: rgb(51, 51, 51);" class=""><font face="Avenir-Book" class=""><br class=""></font></span></div><div class=""><div style="box-sizing: border-box; margin-top: 0px; color: rgb(51, 51, 51); margin-bottom: 0px !important;" class=""><font face="Avenir-Book" class="">One such use case is when extending ones own code, it's nice to break similar code blocks/behavior into their own extensions sometimes requiring the addition of properties. It would be nice to provide those properties right in line with the new code instead of just having a bunch of properties forced at the top of a main class file.</font></div></div><div style="box-sizing: border-box; margin-top: 0px; color: rgb(51, 51, 51); margin-bottom: 0px !important;" class=""><font face="Avenir-Book" class=""><br class=""></font></div><div style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px !important;" class=""><font face="Avenir-Book" class=""><font color="#333333" class="">Wha-da-ya’all think?</font></font></div><div style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px !important;" class=""><font face="Avenir-Book" class=""><font color="#333333" class=""><br class=""></font></font></div><div style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px !important;" class=""><font color="#333333" face="Avenir-Book" class="">Kevin</font></div></body></html>