# Please support properties in class interfaces

**URL:** <https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269>\
**Category:** Bugs and Feature Requests\
**Created:** [May 11, 2024, 6:08am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269 "2024-05-11T06:08:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![GarryPettet](https://forum.xojo.com/user_avatar/forum.xojo.com/garrypettet/32/31_2.png) [@GarryPettet](https://forum.xojo.com/u/GarryPettet)\
**Post date:** [May 11, 2024, 6:08am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/1 "2024-05-11T06:08:59Z")

</div>

Feedback Case Number: [76261](https://tracker.xojo.com/xojoinc/xojo/-/issues/76261).

There are several requests for class interfaces to support properties dating back up to **15 years** in various states of closure or just simply being ignored by Xojo e.g: [19070](https://tracker.xojo.com/xojoinc/xojo/-/issues/19070), [20443](https://tracker.xojo.com/xojoinc/xojo/-/issues/20443), [5938](https://tracker.xojo.com/xojoinc/xojo/-/issues/5938), [59033](https://tracker.xojo.com/xojoinc/xojo/-/issues/59033) and [74262](https://tracker.xojo.com/xojoinc/xojo/-/issues/74262).

Currently, you can only add methods to a class interface, these are there enforced / added by the IDE when you create a custom class implementing your interface.

There are many times when I require classes to possess a property as part of an API I’m creating. The current implementation of interfaces doesn’t support properties which means you need to add a method pair instead.

Consider the situation where I would like a collection of classes to have the property `Name`. For this to be part of an interface in Xojo I would need to create two methods to simulate this:

```xojo
Public Function Name() As String
End Function

Public Sub Name(value As String)
End Sub

```

Implementing this interface would also require my classes to have a third (private) property, say `mName` that would hold the actual name that I could manipulate in the above two methods.

If you are building an API with many classes implementing an interface (in my current project I have 88 classes implementing a single interface) you would need to repeat the implementation of this `88 * 2 = 176` times! It is a colossal waste of time.

Most other languages that implement interfaces support properties and methods and I think 15 years is enough time to wait for Xojo to do the same.

What do others think?

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [May 11, 2024, 6:56am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/2 "2024-05-11T06:56:37Z")

</div>

I’m completely for it ! and for long ago…

---

<div class="post-metadata">

**Author:** ![GarryPettet](https://forum.xojo.com/user_avatar/forum.xojo.com/garrypettet/32/31_2.png) [@GarryPettet](https://forum.xojo.com/u/GarryPettet)\
**Post date:** [May 11, 2024, 6:57am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/3 "2024-05-11T06:57:54Z")

</div>

Don’t forget to add a thumbs up to the issue on the tracker linked above (since that’s supposedly how Xojo know which issues are important to us).

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [May 11, 2024, 7:00am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/4 "2024-05-11T07:00:13Z")

</div>

now that the api change (mess) is on it’s way out, that android is almost out, it is time to enforce the xojo base language, like the properties for class interfazces, or the ability to have classes inside external modules…

---

<div class="post-metadata">

**Author:** ![Alex\_Bombay](https://forum.xojo.com/user_avatar/forum.xojo.com/alex_bombay/32/224_2.png) [@Alex\_Bombay](https://forum.xojo.com/u/Alex_Bombay)\
**Post date:** [May 11, 2024, 7:40am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/5 "2024-05-11T07:40:25Z")

</div>

Gave the issue a thumbs up, I am in full support of this.

---

<div class="post-metadata">

**Author:** ![Daniel\_Fritzsche](https://forum.xojo.com/user_avatar/forum.xojo.com/daniel_fritzsche/32/478_2.png) [@Daniel\_Fritzsche](https://forum.xojo.com/u/Daniel_Fritzsche)\
**Post date:** [May 11, 2024, 7:42am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/6 "2024-05-11T07:42:20Z")

</div>

I also added my vote. This would improve productivity for us.

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [May 11, 2024, 8:26am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/7 "2024-05-11T08:26:34Z")

</div>

> [@GarryPettet](#):
>
> Consider the situation where I would like a collection of classes to have the property `Name`.

i remember we had many discussions about properties for interfaces.

in example for the name for all classes it is somehow a propertie of the base class which is adressed by super =

---

<div class="post-metadata">

**Author:** ![Daniel\_Fritzsche](https://forum.xojo.com/user_avatar/forum.xojo.com/daniel_fritzsche/32/478_2.png) [@Daniel\_Fritzsche](https://forum.xojo.com/u/Daniel_Fritzsche)\
**Post date:** [May 11, 2024, 10:55am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/8 "2024-05-11T10:55:26Z")

</div>

> in example for the name for all classes it is somehow a propertie of the base class which is adressed by super =

There are situations when classes, which do not share the same super, can be used via interfaces to make things easier. So in these situations you should be able to add properties to an interface.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [May 11, 2024, 11:53am UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/9 "2024-05-11T11:53:17Z")

</div>

Not sure if I’m following the idea, but you guys want, in Xojo terms, “computed properties” in the interface, correct? Because interfaces are not intended for data, just “accessors” to the data in the class where the user will implement it (much like methods).

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [May 11, 2024, 12:02pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/10 "2024-05-11T12:02:00Z")

</div>

Computer properties are not “Data” per see.

And most other languages have computer properties in Interfaces.

And they should always be implemented as such (Computed) if Interface defines it. (and never as direct data property).

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [May 11, 2024, 12:03pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/11 "2024-05-11T12:03:18Z")

</div>

> [@Björn\_Eiríksson](#):
>
> Computer properties are not “Data” per see.

That’s why I asked. They seem not talking about Computed, but Properties, data, per se.

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [May 11, 2024, 12:04pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/12 "2024-05-11T12:04:08Z")

</div>

Yea I know I signed onto the request and added additional note on that.

 ![image](https://forum.xojo.com/uploads/default/original/3X/6/e/6e39eeb67114e9c3ffd3c3a5561e84df0544036b.png)

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [May 11, 2024, 12:05pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/13 "2024-05-11T12:05:25Z")

</div>

> [@Björn\_Eiríksson](#):
>
> [I’ve] added additional note on that

👍🏻

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [May 11, 2024, 12:50pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/14 "2024-05-11T12:50:03Z")

</div>

Properties as in computed or normal just like swift does in protocols is the most flexible way to go.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [May 11, 2024, 1:00pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/15 "2024-05-11T13:00:19Z")

</div>

> [@DerkJ](#):
>
> Properties as in computed **or normal just like swift does in protocols**

I’m not aware that Swift allows what you are saying (regular properties).  
AFAIK Swift implements Property accessors (Getters/Setters) in Protocols as Computed Properties are in Xojo.

---

<div class="post-metadata">

**Author:** ![Daniel\_Fritzsche](https://forum.xojo.com/user_avatar/forum.xojo.com/daniel_fritzsche/32/478_2.png) [@Daniel\_Fritzsche](https://forum.xojo.com/u/Daniel_Fritzsche)\
**Post date:** [May 11, 2024, 1:06pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/16 "2024-05-11T13:06:54Z")

</div>

Computed properties would be fine.

I think an interface should not define data storage. That’s up to the class implementing the interface.

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [May 11, 2024, 1:09pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/17 "2024-05-11T13:09:24Z")

</div>

The only thing an interface would define is:  
“You are required to have an property of type x”  
If it’s an normal property or computed should be free to be chosen if this can be created by xojo.  
It allows to circumvent shadowing properties that would otherwise cause issues.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [May 11, 2024, 1:10pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/18 "2024-05-11T13:10:36Z")

</div>

I also would suggest to let people add a property to the interface definition. Then the implementer of the property should be able to define whether they use a regular property or a computed property.

Method pairs don’t work with the existing property handling in Xojo as far as I know.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [May 11, 2024, 1:10pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/19 "2024-05-11T13:10:40Z")

</div>

> [@Daniel\_Fritzsche](#):
>
> I think an interface should not define data storage.

Interfaces/protocols works this way by definition, the talk to the Class, not the storage, the storage (if any, because it can be virtual) the designer of the class will take care.

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [May 11, 2024, 1:12pm UTC](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269/20 "2024-05-11T13:12:46Z")

</div>

Swift:

[https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols/](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols/)

> A protocol can require any conforming type to provide an instance property or type property with a particular name and type. The protocol doesn’t specify whether the property should be a stored property or a computed property — it only specifies the required property name and type. The protocol also specifies whether each property must be gettable or gettable _and_ settable.

This is the most flexible and error free solution.

[Next page](https://forum.xojo.com/t/please-support-properties-in-class-interfaces/80269.md?page=2)
