Snippets de código Xcode

Cada vez que eu tentava configurar um UITableView, ficava frustrado em escrever todos os delegados de visualização de tabela, então, após eras fazendo isso, finalmente descobri trechos de código no Xcode.

  1. Escreva algum código no Xcode,
  2. selecione a parte desejada do código,
  3. arraste e solte-o na Biblioteca de trechos de código,
  4. para reutilizar o código, simplesmente arraste-o da biblioteca para o seu projeto.

Aqui está meu snippet para delegados UITableView:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return <#number of sections#>
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return <#number of rows in section#>
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return <#row height#>
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString* cellIdentifier = @"CellIdentifier";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell
= [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}

cell
.textLabel.text = @"";

return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

}

Cenário