How often: explain your problem well, and you can find the answer yourself. This is a naming issue. By renaming the factory method to something else, such as defaultAssistant or something unrelated, for example makeThisInstanceForMe , I can easily access it from Swift. It seems that the creator of the swift header is deleting uppercase letters to see if this matches the function name (case insensitive), and if so, then instead of the class function, it turns into a call to the Swift initializer.
However, keep in mind the factory method call as a method / function (including parentheses), otherwise you will get something else, but not what you expect. If you specify a type, you cannot actually call it.
LLDB output if you do not use parentheses:
(lldb) po assistant
(Pecunia`_TPA__TTOFCSo11MOAssistant8makeThisfMS_FT_GSQS__ at RemoteResourceManager.swift)
This problem is actually another dangerous problem that you get if you use automatic / weak typing. There is a reason why weak languages ββare considered dangerous, although they are convenient.
source share