<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="">Hi everyone!<div class=""><br class=""></div><div class="">I’m experimenting with&nbsp;<a href="https://en.wikipedia.org/wiki/Entity_component_system" class="">Entity-Component Systems</a>&nbsp;and I’d appreciate if you could help me working on how to check/get custom objects from a collection.</div><div class=""><br class=""></div><div class="">The idea is to verify if an entity contains a particular component and, if so, retrieve it.</div><div class=""><br class=""></div><div class="">Here’s the API I’d like work on:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(192, 192, 192);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">// Entity Library</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;Character:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">Entity</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;{}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(192, 192, 192);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">// Component Library</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;HealthComponent:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">Component</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;health&nbsp;</span>= 100.0</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;isDead&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures;" class="">=&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">false</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;AttackComponent:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">Component</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;range&nbsp;</span>= 0</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;damage&nbsp;</span>= 0</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div></div><div class=""><br class=""></div><div class=""><span style="color: rgb(192, 192, 192); font-family: Menlo; font-size: 11px;" class="">// Usage</span></div><div class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;healthComponent =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">HealthComponent</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;attackComponent =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">AttackComponent</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(88, 126, 168);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">&nbsp;components: [</span><span style="font-variant-ligatures: no-common-ligatures;" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">] = [</span><span style="font-variant-ligatures: no-common-ligatures;" class="">healthComponent</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">,&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures;" class="">attackComponent</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;char =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">Character</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(components:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">components</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;hc =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">char</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.get(component:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">HealthComponent</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(222, 52, 140);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;ac =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">char</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.get(component:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(88, 126, 168);" class="">AttackComponent</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">So, what are your thoughts on the TODOs below?</div><div class=""><br class=""></div><div class="">—</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Foundation</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ComponentType {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> entity: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">EntityType</span><span style="font-variant-ligatures: no-common-ligatures" class="">? { </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">get</span><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures" class=""> EntityType {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> components: [</span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">] { </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">get</span><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> get&lt;T: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;(component c: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">.Type) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">?</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> add(component c: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> remove(component c: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">class</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Component: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> entity: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">EntityType</span><span style="font-variant-ligatures: no-common-ligatures" class="">?</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">class</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Entity: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">EntityType</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> components = [</span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">]()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(components: [</span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">]) {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> component </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> components {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">add</span><span style="font-variant-ligatures: no-common-ligatures" class="">(component: component)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> get&lt;T: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;(component c: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">.Type) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">? {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #c0c0c0" class="">// TODO: - not sure how to work the types here</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: rgb(192, 192, 192); font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">// if `self` contains component of given type, return it</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(192, 192, 192);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// otherwise, return nil</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> add(component c: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">) {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #c0c0c0" class="">// TODO: - depends on the `get` function</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(192, 192, 192);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// if `self` already contains component, just return</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(192, 192, 192);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// otherwise, self.components += [component]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #de348c" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> remove(component c: </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">ComponentType</span><span style="font-variant-ligatures: no-common-ligatures" class="">) {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #c0c0c0" class="">// TODO:&nbsp;</span><span style="color: rgb(192, 192, 192);" class="">- also depends on the `get` function</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(192, 192, 192);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// if `self` contains component, remove it</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(192, 192, 192);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">// otherwise, just return</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">—A</div></body></html>