Group Group Group Group Group Group Group Group Group

Chapter 15 (Ed. 1 & 2) Using TimelineTableViewCell

Are we supposed to use Swift Package Manager or CocoaPods to install TimelineTableViewCell or something? If I open the starter project, I see TimelineTableViewCell. In fact, the book (Ed. 2) says “The starter project for this chapter already includes the package.” But if I try to import TimelineTableViewCell, I get an error. Besides, what kind of an author explains a framework built by Apple using something made by a total stranger?

In the second edition, the control is now included through Swift Package Manager. As noted in the chapter, Swift 5.2 doesn’t support including resources through Swift Package Manager — including the custom nib file used by the TimelineTableViewCell control. You need to manually copy the TimelineTableViewCell.xib to your project for it to compile. The starter project includes this step in the UI group. This limitation fortunately goes away in Swift 5.3 and therefore hopefully the next version of Xcode.

As for the purpose, this section demonstrates bringing a custom control built without knowledge of SwiftUI into a SwiftUI project. Some of the issues you might run into are worked through including this resource issue. This control was chosen as it is open source and hosted on Github, which is a common case.

As noted in the chapter

Please tell me at what page you explain that we need Swift 5.3 or that we need to manually copy TimelineTableViewCell.xib to our project. Besides, I have never even heard of Swift Package Manager before though I’ve been writing code in Swift for 4 years.

Swift 5.3 isn’t needed. The book was written for Swift 5.2 and Xcode 11.4. Swift 5.3 is not available as part of Xcode yet.

Swift Package Manager is an Apple project and you can see more at https://developer.apple.com/documentation/swift_packages. It came out during the Xcode 9 time frame.

The third paragraph on page 374 of the PDF file describes needing to copy the file.

The third paragraph on page 374 of the PDF file describes needing to copy the file.

I don’t know if those who have never used Swift Package Manager get that message.

The third paragraph says

Since Swift Package Manager doesn’t currently support bundling resources — including the custom nib file used by the TimelineTableViewCell control — you’ll see a copy of the nib file in the UI group in the main project. Hopefully, a future version of Swift Package Manager will make this step unnecessary.

It doesn’t say that you need to copy the file. It says that we’ll see a copy of the nib file. Besides, the end of the second paragraph says

The starter project for this chapter already includes the package.

For those who have never used Swift Package Manager, the statements in the book are ambiguous. The book says the starter project includes the package and that we have a copy of the nib file, which doesn’t ring us a bell such that we need to manually copy a file. I don’t know why you don’t specially say IN THE BOOK that you need to manually copy a xib file if your Swift version is 5.2 or lower so that there is no ambiguity. Is that too much to ask? Lastly, if you say one more word to defend your ambiguity, I’ll request a refund for this book. I’m done talking.

I’ll make a note to make this more clear in the next update.