4/12/2023 0 Comments Swift code in objective c![]() ![]() We’re using a Master-Detail project since it comes with a UITableView already set up so we won’t have to retype all of that boilerplate. Then fire up Xcode and create a new Master-Detail Project. If you really don’t want to right now then head over to GitHub and download the zip file.) Clone the repo so you have a local copy of the files: git clone you don’t have git set up already, I strongly recommend it. You’ll need to download the DZNEmptyDataSet files. Importing Code Manuallyįirst we’ll do it by importing the code files manually, then we’ll show how it could be done quicker & easier with Cocoapods. Fortunately interop between Objective-C and Swift isn’t difficult. Here’s what it’ll look like when we’re done:īut we’re working in Swift and DZNEmptyDataSet is in Objective-C. ![]() You could roll your own solution for that but there’s already a great one called DZNEmptyDataSet. A nice solution is to show the user an informative message, maybe with a button to take an appropriate action, when you don’t have any data to show in a tableview. ![]() Our MotivationĪn empty tableview is an ugly thing. ![]() This tutorial has been updated for Swift 2.0, Xcode 7, and DZNEmptyDataSet 1.7.2. We’ll do it first by importing the files into the project manually, then we’ll do it using CocoaPods. Today we’ll figure out how to use an Objective-C class in a Swift project. While Swift is quickly gaining popularity there’s are still tons of great bits of code only available in Objective-C that you might want to use in your project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |