How to Create a Swift Module (framework)

Опубликовано: 21 Апрель 2021
на канале: Sparkcode
14,003
192

In this video I show how to create a Swift module so that you can add your own custom framework to your projects.

Once you add your Swift module make sure to open your app's 'xcworkspace' and NOT the 'xcproject' (1:20)
Make sure you add the framework to "Frameworks, Libraries, and Embedded Content" section of the General tab of the app settings (3:37)
Any code that you want exposed by the framework must have the 'public' access control modifier (2:26)

Separating your code into isolated modules can greatly speed up the development process. Since modules are smaller than your app they will compile faster which means you can develop your module code independently from your app.

I have found using modules to be really handy in separating concerns and help me make my code generally cleaner. By avoiding a giant monolithic project my code tends to be less tightly coupled, and becomes more flexible.