teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

s

2018/05/30 22:03

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -4,4 +4,19 @@
4
4
 
5
5
  参考URL:
6
6
  [The Swift Programming Language (Swift 4.1) - Properties](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html)
7
- [Stored property と Computed property](https://qiita.com/tekun43/items/5e1d7972ed0b54daeb04)
7
+ [Stored property と Computed property](https://qiita.com/tekun43/items/5e1d7972ed0b54daeb04)
8
+
9
+ そしておそらくMarkfourXさんのやりたいこととしてはこの場合保存型プロパティで、以下の様になります。
10
+ この場合の初期値は`空文字`になります。
11
+
12
+ ```swift
13
+ class TitleTableViewCell: UITableViewCell {
14
+ @IBOutlet private weak var titleLabel: UILabel!
15
+
16
+ public var title: String = "" {
17
+ didSet {
18
+ titleLabel.text = title
19
+ }
20
+ }
21
+ }
22
+ ```