swift - Why does CGColor.copy() return an optional value? -


so since function cgcolor.copy() returns optional value, 1 assume there might reason return nil. cannot think of reason fail other if cgcolor optional value. since using in program know reason return nil on value not optional?

i think you've explained correctly. remember, there no such object cgcolor; doesn't have methods copy. hand-tweaked rendering of global c function:

cgcolorref cgcolorcreatecopy(cgcolorref color); 

well, cgcolorref can nil, color can nil, result can nil. result has optional. (it can't optional , @ other times not optional.)


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -