exponea / exponea-ios-sdk

MIT License
19 stars 27 forks source link

Internal extensions polluting global scope #53

Closed ondrej-hanslik-csob-cz closed 7 months ago

ondrej-hanslik-csob-cz commented 7 months ago

Swift extensions on system objects, e.g. Array[safeIndex:] or String(safeString:) are polluting global scope because they are declared as public.

Problem - the functions declared in these extensions conflict with extensions that have the same name in the app itself.

Note that Swift extensions do not always require the module to be imported. It is enough for the module to be imported in other files of the same module and these public methods will cause name conflicts.

Proposed solutions:

  1. do not make these extensions public (ideal)
  2. give these functions unique name (e.g. init(exponeaSafeString:)).
adam1929 commented 7 months ago

Hi @ondrej-hanslik-csob-cz thank you for your opinion. Although these extensions could be helpful - it is correct idea to not expose them to publicity directly. Meanwhile, please apply your solutions to your app (i.e. unique Array[appSafeIndex:]) until SDKs API will be hidden for these extensions.

xcibik00 commented 6 months ago

Hi @ondrej-hanslik-csob-cz , already changed in 2.21.0