0Pricing
Objective-C iOS Development for Legacy & Enterprise Apps · Aula

Trabalhar com NSString e Tipos Foundation

Domine as principais classes Foundation do Objective-C — NSString, NSArray e NSDictionary — para lidar com texto e coleções em aplicações iOS legadas.

Trabalhar com NSString e Tipos Foundation é uma aula grátis de Objective-C iOS Development for Legacy & Enterprise Apps no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Objective-C iOS Development for Legacy & Enterprise Apps, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Objective-C iOS Development for Legacy & Enterprise Apps inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

The Foundation Framework

Beyond primitives, Objective-C leans on the Foundation framework for rich objects — most often NSString, NSArray, and NSDictionary.

Creating NSStrings

The @ literal builds an NSString — a full object with many helper methods, unlike a bare C string.

NSString *name = @"Ada Lovelace";
NSLog(@"Name: %@", name);

Common String Methods

NSString ships with handy methods: length, uppercaseString, stringByAppendingString:, and hasPrefix:.

NSString *greeting = [@"Hello, " stringByAppendingString:name];
NSUInteger len = greeting.length;

Formatting Strings

Build dynamic text with stringWithFormat:. The %@ token prints any object.

int score = 42;
NSString *msg = [NSString stringWithFormat:@"%@ scored %d", name, score];

Mutable Strings

NSString is immutable, so to edit text in place reach for NSMutableString.

NSMutableString *buffer = [NSMutableString stringWithString:@"Hi"];
[buffer appendString:@" there"];

NSArray Basics

NSArray is an ordered, immutable list created with the @[] literal, indexed from zero.

NSArray *colors = @[@"red", @"green", @"blue"];
NSString *first = colors[0];
NSUInteger count = colors.count;

NSMutableArray

When the list changes at runtime, use NSMutableArray with addObject: and removeObject:.

NSMutableArray *items = [NSMutableArray array];
[items addObject:@"apple"];
[items removeObjectAtIndex:0];

NSDictionary Basics

NSDictionary stores key-value pairs, built with the @{} literal and read by key.

NSDictionary *user = @{@"name": @"Ada", @"age": @36};
NSString *n = user[@"name"];

NSNumber Boxing

Collections hold objects, not primitives, so wrap numbers in NSNumber with @, then unbox via intValue.

NSNumber *boxed = @42;
int raw = [boxed intValue];

Iterating Collections

Walk any collection cleanly with Objective-C's fast enumeration for-in loop.

for (NSString *color in colors) {
  NSLog(@"%@", color);
}

Why Foundation Matters

Nearly every legacy iOS API takes or returns Foundation types, so fluency here is essential before touching UIKit or networking.

Quick Check

Test your Foundation knowledge.

Recap

Recap: NSString (and mutable variant) for text, stringWithFormat for dynamic strings, NSArray and NSDictionary for collections, and NSNumber to box primitives.

Perguntas Frequentes

A aula “Trabalhar com NSString e Tipos Foundation” é grátis?

Sim — o texto completo de “Trabalhar com NSString e Tipos Foundation” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Objective-C iOS Development for Legacy & Enterprise Apps, atualize para CoddyKit PRO. O curso de Objective-C iOS Development for Legacy & Enterprise Apps inclui 4 aulas no total.

O que vou aprender em “Trabalhar com NSString e Tipos Foundation”?

Domine as principais classes Foundation do Objective-C — NSString, NSArray e NSDictionary — para lidar com texto e coleções em aplicações iOS legadas. Você pratica Objective-C iOS Development for Legacy & Enterprise Apps com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Objective-C iOS Development for Legacy & Enterprise Apps?

Nenhuma experiência prévia é necessária. Objective-C iOS Development for Legacy & Enterprise Apps no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Trabalhar com NSString e Tipos Foundation”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Objective-C iOS Development for Legacy & Enterprise Apps?

Sim. Cada aula de Objective-C iOS Development for Legacy & Enterprise Apps inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Introdução ao Objective-C
  2. Sintaxe e Tipos de Dados Básicos
  3. Configuração do Xcode para Objective-C
  4. Trabalhar com NSString e Tipos Foundation
← Voltar para Objective-C iOS Development for Legacy & Enterprise Apps