File tree Expand file tree Collapse file tree 2 files changed +2
-14
lines changed
bk2ch08p438searchableTable2/ch21p718sections
bk2ch08p438searchableTable/ch21p718sections Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,7 @@ class SearchResultsController : UITableViewController {
1717
1818 init ( data: [ [ String ] ] ) {
1919 // we don't use sections, so flatten the data into a single array of strings
20- var flattened = [ String] ( )
21- for arr in data {
22- for s in arr {
23- flattened += [ s]
24- }
25- }
26- self . originalData = flattened
20+ self . originalData = data. reduce ( [ String] ( ) , + )
2721 super. init ( nibName: nil , bundle: nil )
2822 }
2923
Original file line number Diff line number Diff line change @@ -9,13 +9,7 @@ class SearchResultsController : UITableViewController {
99
1010 func takeData( data: [ [ String ] ] ) {
1111 // we don't use sections, so flatten the data into a single array of strings
12- var flattened = [ String] ( )
13- for arr in data {
14- for s in arr {
15- flattened += [ s]
16- }
17- }
18- self . originalData = flattened
12+ self . originalData = data. reduce ( [ String] ( ) , + )
1913 }
2014
2115 override func viewDidLoad( ) {
You can’t perform that action at this time.
0 commit comments