I am trying to read a plist file present in Xcode bundle,
Approach #1 (Didn't work):
I was using a static variable(Line #23 in below screenshot) which returns the path of file present in bundle, It didn't work

Approach #2 (Didn't work):
Using Bundle.main to read a file didn't work

Approach #3 (Working solution):
When I write a function (Line #30 in below screenshot) with same lines of code, It works!

Initially I was trying to read file using the static variable and wasted 2 days, until I figured out that using function instead of static variable would work.
Questions:
- I cant find any relevant documentation, Can anyone explain why this Approach #1 didn't work?
- Is the
type(of:)specific forobjecttype notclasstype?