Inside Weather App, let’s add the target first.

Include the Unit Test, we’re going to move the previous unit tests along with the code migrating to framework.

Move the Services, Support, and Model folders into WeatherKit. Then change the Target Membership to WeatherKit. We’ll also need to make the APIManager and WeatherManager public .

We then build WeatherKit with Generic iOS Device, and then add import WeatherKit at the top of WeatherViewController. Run the app, it should work totally fine!

Same as what we’ve did with our WeatherKit, we’ll move our tests to WeatherKitTests. Make sure to change the target membership to WeatherKitTests and change the @testables to @testable import WeatherKit

Press ⌘ + U and test it out. It’s only natural to feel a bit trivial doing some small but necessary modifications.

By the way, if we look into code coverage, we’ll see that WeatherKitTests is now separated from the Weather App.

Great! We’ve successfully split code which is shared between the extension and the app to a framework.