File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
TableViewCellWithAutoLayout/TableViewController Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,15 @@ import Foundation
99
1010class Model
1111{
12- var dataArray : NSMutableArray = [ ]
12+ var dataArray : Array < ( title : String , body : String ) > = Array ( )
1313
1414 func populate( )
1515 {
1616 var fontFamilies = UIFont . familyNames ( )
17+
1718 for familyName : AnyObject in fontFamilies {
1819 if let familyNameString: String = familyName as? String {
19- dataArray. addObject ( [ " title " : familyNameString, " body " : randomLoremIpsum ( ) ] )
20+ dataArray. append ( ( title: familyNameString, body: randomLoremIpsum ( ) ) )
2021 }
2122 }
2223 }
@@ -29,7 +30,7 @@ class Model
2930 let familyName : AnyObject = fontFamilies [ r]
3031
3132 if let familyNameString: String = familyName as? String {
32- dataArray. addObject ( [ " title " : familyNameString, " body " : randomLoremIpsum ( ) ] )
33+ dataArray. append ( ( title: familyNameString, body: randomLoremIpsum ( ) ) )
3334 }
3435 }
3536
Original file line number Diff line number Diff line change @@ -104,9 +104,9 @@ class TableViewController : UITableViewController
104104
105105 // Configure the cell for this indexPath
106106 cell. updateFonts ( )
107- let modelDictionary = model. dataArray [ indexPath. row] as NSDictionary
108- cell. titleLabel. text = modelDictionary . valueForKey ( " title " ) as String
109- cell. bodyLabel. text = modelDictionary . valueForKey ( " body " ) as String
107+ let modelItem = model. dataArray [ indexPath. row]
108+ cell. titleLabel. text = modelItem . title
109+ cell. bodyLabel. text = modelItem . body
110110
111111 // Make sure the constraints have been added to this cell, since it may have just been created from scratch
112112 cell. setNeedsUpdateConstraints ( )
You can’t perform that action at this time.
0 commit comments