0Pricing
Objective-C iOS Development for Legacy & Enterprise Apps · Lección

Trabajo con NSString y tipos de Foundation

Domine las clases principales de Foundation de Objective-C —NSString, NSArray y NSDictionary— para gestionar texto y colecciones en aplicaciones iOS heredadas.

Trabajo con NSString y tipos de Foundation es una lección gratuita de Objective-C iOS Development for Legacy & Enterprise Apps en CoddyKit. Esta es la lección 4 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Objective-C iOS Development for Legacy & Enterprise Apps, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Objective-C iOS Development for Legacy & Enterprise Apps incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en 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.

Preguntas frecuentes

¿La lección «Trabajo con NSString y tipos de Foundation» es gratis?

Sí — el texto completo de «Trabajo con NSString y tipos de Foundation» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Objective-C iOS Development for Legacy & Enterprise Apps, actualiza a CoddyKit PRO. El curso de Objective-C iOS Development for Legacy & Enterprise Apps incluye 4 lecciones en total.

¿Qué aprenderé en «Trabajo con NSString y tipos de Foundation»?

Domine las clases principales de Foundation de Objective-C —NSString, NSArray y NSDictionary— para gestionar texto y colecciones en aplicaciones iOS heredadas. Practicas Objective-C iOS Development for Legacy & Enterprise Apps con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Objective-C iOS Development for Legacy & Enterprise Apps?

No se requiere experiencia previa. Objective-C iOS Development for Legacy & Enterprise Apps en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 4 de 4.

¿Cuánto tiempo toma la lección «Trabajo con NSString y tipos de Foundation»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Objective-C iOS Development for Legacy & Enterprise Apps?

Sí. Cada lección de Objective-C iOS Development for Legacy & Enterprise Apps incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Introducción a Objective-C
  2. Sintaxis y tipos de datos básicos
  3. Configuración de Xcode para Objective-C
  4. Trabajo con NSString y tipos de Foundation
← Volver a Objective-C iOS Development for Legacy & Enterprise Apps