Kodeco Forums

Core Text Tutorial for iOS: Making a Magazine App

Learn how to make your own magazine app with custom text layout in this Core Text tutorial for iOS.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/578-core-text-tutorial-for-ios-making-a-magazine-app

Iā€™m still on Xcode 8 swift 3 ā€¦ does it work or thereā€™s still older version of this tutorial available?

1 Like

I am also using Swift 3 and Xcode 8.3.3 and found that in following the tutorial up to the end of ā€œOnto the Magazine Appā€ (just before the section ā€œA Basic magazine Layoutā€) I get an error of ā€˜unresolved identifierā€™ on the line (with NSAttributedStringKey)

let attrs = [NSAttributedStringKey.foreground: color, NSAttributedStringKey.font: font] as [NSAttributedStringKey : Any]

Do you have a version available, using my Swift and Xcode versions, please? Thank you.

[I noticed that Swift 4 and Xcode 9 will not be released until the Fall and Iā€™d like to get my App working before then. I did download the Beta versions of 4/9 and run the project successfully based on the code above]

In Swift 3 attributes are declared as [String: Any] and attribute names are declared separately, so replace that line with

let attrs = [NSForegroundColorAttributeName: color, NSFontAttributeName: font] as [String: Any]

It should work.

After I finish project, I still feel confused. Because i did wok with webView load HTML. What is the different webView vs CoreText ?

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]