![]() ![]() I thought that the process would be fairly straightforward, but I was wrong. I faced a lot of challenges that I will describe in order to help you out if you decide to start with this project (and also to have a reference for myself if I have to do it again). Use properties instead of instance variables where applicable.Instead of id as a return type your class uses instancetype, which will improve type safety.Let’s start! Step 1 – Modernize your Objective-C codeįirst of all make sure that every new file you create, if possible, is in Swift, if not, modernize your Objective-C code. ![]() Change enum to NS_ENUM, this will improve code competition in Xcode and will specify the type and size of your enums.When creating properties you get by default getter and setter methods automatically, you will also have access to property attributes such as: weak, assign, retain etc. ![]() This is recommended by Apple and you can read more details about it on this documentation page. To import Swift code in Objective-C first of all you need to have an Objective-C bridging header. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |