Accessing Swift variables added by Folder reference

后端 未结 2 1008
一生所求
一生所求 2021-01-07 11:18

Actually I spend around 3 hours in this simple problem and googled it a lot but no way. My question is very simple. I want to add a directory as a \"Folder Reference\" to my

2条回答
  •  天涯浪人
    2021-01-07 12:04

    Update: if you are using folder references, there is no way to import them and you must reference them using the full directory path.

    EX:

    let image = UIImage(named: "Images/Icons/GoPago")
    

    That is the only way. Depending on what your project requires, I would suggest using groupings like below.

    The problem is that you are using folders and not grouping. There is no import needed. You just need to take everything in the folder and "group" it through xCode. Then you will be able to access it in your code. It should look as a yellow folder when you group it in there. Like so:

    and it should look like this:

    if you are copying over a directory, you would want to make sure to select create groups as follows. :

提交回复
热议问题