# Subclass from SKLabelNode

**URL:** <https://forums.kodeco.com/t/subclass-from-sklabelnode/140874>\
**Category:** Sprite Kit\
**Created:** [May 25, 2021, 9:34pm UTC](https://forums.kodeco.com/t/subclass-from-sklabelnode/140874 "2021-05-25T21:34:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mamazur](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mamazur/32/81494_2.png) [@mamazur](https://forums.kodeco.com/u/mamazur)\
**Post date:** [May 25, 2021, 9:34pm UTC](https://forums.kodeco.com/t/subclass-from-sklabelnode/140874/1 "2021-05-25T21:34:11Z")

</div>

2D\_Apple\_Games  
Chapter 9  
Intermediate Physics  
page 240  
Xcode Version 12.5.

I got 2 compiler messages.  
Incorrect labels for candidate (have: ‘(fontName:)’, expected: ‘(message:)’) for  
**convenience**  **init** (message: String){

No exact matches in call to initializer for  
**self**.init(fontName: “AvenirNext-Regular”)

The code from book(page 240):  
class MessageNode: SKLabelNode {

convenience init(message: String) {

self.init(fontNamed: “AvenirNext-Regular”)

text = message

fontSize = 256.0

fontColor = SKColor.gray

zPosition = 100

let front = SKLabelNode(fontNamed: “AvenirNext-Regular”)

front.text = message

front.fontSize = 256.0

front.fontColor = SKColor.white

front.position = CGPoint(x: -2, y: -2)

addChild(front)

Please help.  
P.S. Please understand that I am no looking for code that avoid to subclass SKLabelNode. I would like to find a code to allow subclassing SKLabelNode.  
Thank you

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [November 8, 2021, 1:34pm UTC](https://forums.kodeco.com/t/subclass-from-sklabelnode/140874/2 "2021-11-08T13:34:32Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
