I'm just getting started with programming GUIs on apple (so far the framework seems fine, but I find the documentation far less informative than others...Qt, .Net, java, etc).
One of the issues I have had is understanding who owns what. For example, if I call CTLineRefCreateWithAttributedString, does the resulting CTLineRef own the attributed string? What if the attributed string is mutable, and I change it? Will this mess up the CTLineRef?
The documentation has been unenlightening.
The reference for CTLineRef provides no information on the subject: https://developer.apple.com/library/mac/#documentation/Carbon/Reference/CTLineRef/Reference/reference.html
Some examples don't release the string, which I take as an indicator that it is owned: https://developer.apple.com/library/mac/#documentation/StringsTextFonts/Conceptual/CoreText_Programming/Operations/Operations.html
Some examples do release the string, which would suggest it is not: https://developer.apple.com/library/mac/#samplecode/CoreAnimationText/Listings/VectorTextLayer_m.html
(this one isn't apple, but he seems more informed them I) http://www.cocoanetics.com/2011/01/befriending-core-text/
So is the string copied or not? If I use a CFMutableAttributedStringRef can I change that or not (I assume I would have to create a new CTLineRef afterwards)?
This is a specific example, but this is question that I have come up against in innumerable places. Any help would be very much appreciated. I feel that there must be some rules that govern these things, but I haven't the slightest idea what those rules are or where I can find them.