The Foundation Kit provides basic Objective-C classes and structures

Introduced classes

extern class NSData

cocoa :: NSData

Wrapper of byte buffers
extern class NSError

cocoa :: NSError

Error condition
extern class NSIndexPath

cocoa :: NSIndexPath

Path to a specific node in a tree of nested array collections
extern class NSObject

cocoa :: NSObject

Base of the Foundation framework class hierarchy
extern class NSString

cocoa :: NSString

String of the Foundation Kit
extern class NSUserDefaults

cocoa :: NSUserDefaults

Interface to the defaults system for an app to customize its behavior to match a user's preferences

Redefined classes

redef extern class CString

cocoa :: foundation $ CString

C string char *
redef abstract class Text

cocoa :: foundation $ Text

High-level abstraction for all text representations

All class definitions

redef extern class CString

cocoa :: foundation $ CString

C string char *
extern class NSData

cocoa $ NSData

Wrapper of byte buffers
extern class NSError

cocoa $ NSError

Error condition
extern class NSIndexPath

cocoa $ NSIndexPath

Path to a specific node in a tree of nested array collections
extern class NSObject

cocoa $ NSObject

Base of the Foundation framework class hierarchy
extern class NSString

cocoa $ NSString

String of the Foundation Kit
extern class NSUserDefaults

cocoa $ NSUserDefaults

Interface to the defaults system for an app to customize its behavior to match a user's preferences
redef abstract class Text

cocoa :: foundation $ Text

High-level abstraction for all text representations
package_diagram cocoa::foundation foundation core core cocoa::foundation->core cocoa::app_kit app_kit cocoa::app_kit->cocoa::foundation cocoa::hello_cocoa hello_cocoa cocoa::hello_cocoa->cocoa::foundation ios::ios ios ios::ios->cocoa::foundation ios::data_store data_store ios::data_store->cocoa::foundation cocoa::cocoa cocoa cocoa::cocoa->cocoa::app_kit cocoa::cocoa... ... cocoa::cocoa...->cocoa::cocoa a_star-m a_star-m a_star-m->cocoa::hello_cocoa a_star-m->ios::data_store a_star-m... ... a_star-m...->a_star-m ios::glkit glkit ios::glkit->ios::ios ios::http_request http_request ios::http_request->ios::ios ios::hello_ios hello_ios ios::hello_ios->ios::ios ios::uikit uikit ios::uikit->ios::ios ios::glkit... ... ios::glkit...->ios::glkit ios::http_request... ... ios::http_request...->ios::http_request ios::hello_ios... ... ios::hello_ios...->ios::hello_ios ios::uikit... ... ios::uikit...->ios::uikit

Ancestors

module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module array

core :: array

This module introduces the standard array structure.
module bitset

core :: bitset

Services to handle BitSet
module bytes

core :: bytes

Services for byte streams and arrays
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module environ

core :: environ

Access to the environment variables of the process
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module file

core :: file

File manipulations (create, read, write, etc.)
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module kernel

core :: kernel

Most basic classes and methods.
module list

core :: list

This module handle double linked lists
module math

core :: math

Mathematical operations
module native

core :: native

Native structures for text and bytes
module numeric

core :: numeric

Advanced services for Numeric types
module protocol

core :: protocol

module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module re

core :: re

Regular expression support for all services based on Pattern
module ropes

core :: ropes

Tree-based representation of a String.
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module stream

core :: stream

Input and output streams of characters
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O

Parents

module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.

Children

module app_kit

cocoa :: app_kit

The Application Kit provides services to create GUI
module data_store

ios :: data_store

Implements app::data_store using NSUserDefaults
module hello_cocoa

cocoa :: hello_cocoa

Hello world using the Cocoa framework
module ios

ios :: ios

iOS platform support

Descendants

module a_star-m

a_star-m

module assets

ios :: assets

Implementation of app::assets
module audio

ios :: audio

iOS implementation of app::audio using AVAudioPlayer
module cocoa

cocoa :: cocoa

Cocoa API, the development layer of OS X
module cocoa_extern_types

cocoa :: cocoa_extern_types

Test extern classes from the Cocoa framework and extern factories
module cocoa_message_box

cocoa :: cocoa_message_box

Simple message box using the Cocoa framework
module display_ios

gamnit :: display_ios

Gamnit display implementation for iOS
module gamnit_ios

gamnit :: gamnit_ios

Support services for gamnit on iOS
module glkit

ios :: glkit

GLKit services to create an OpenGL ES context on iOS
module hello_ios

ios :: hello_ios

Simple iOS app with a single label
module http_request

ios :: http_request

Implementation of app::http_request for iOS
module input_ios

gamnit :: input_ios

Gamnit event support for iOS
module ui

ios :: ui

Implementation of app::ui for iOS
module uikit

ios :: uikit

File generated by objcwrapper
# The Foundation Kit provides basic Objective-C classes and structures
module foundation is ldflags "-framework Foundation"

in "ObjC Header" `{
	#import <Foundation/Foundation.h>
`}

# Base of the Foundation framework class hierarchy
extern class NSObject in "ObjC" `{ NSObject * `}
end

# String of the Foundation Kit
#
# Created using `Text::to_nsstring`.
extern class NSString in "ObjC" `{ NSString * `}
	super NSObject

	# Null pointer
	new nil in "ObjC" `{ return nil; `}

	# Get an UTF8 encoded `char*` copy of `self`
	fun utf8_string: CString in "ObjC" `{ return (char *)[self UTF8String]; `}

	redef fun to_s do return utf8_string.to_s
end

redef class CString
	# Get a `NSString` from `self` with the specified `length`
	fun to_nsstring(length: Int): NSString in "ObjC" `{
		return [[NSString alloc] initWithBytes:self
			length:length
			encoding:NSUTF8StringEncoding];
	`}
end

redef class Text
	# Get a `NSString` from `self`
	fun to_nsstring: NSString do return to_cstring.to_nsstring(byte_length)
end

# Wrapper of byte buffers
extern class NSData in "ObjC" `{ NSData * `}

	# Pointer to contained data
	fun bytes: CString in "ObjC" `{ return (char*)self.bytes; `}

	# Number of bytes containted in `self`
	fun length: Int in "ObjC" `{ return self.length; `}

	redef fun to_s do return bytes.to_s_with_length(length)
end

# Error condition
extern class NSError in "ObjC" `{ NSError * `}

	# Wraps: `[self initWithDomain:(NSString)domain code:(NSInteger)code userInfo:(NSDictionary)dict]`
	#new init_with_domain_code_user_info(domain: NSString, code: Int, dict: NSDictionary) in "ObjC" `{
	#	return [[NSError alloc] initWithDomain: domain code: code userInfo: dict];
	#`}

	# Wraps: `NSError.domain`
	fun domain: NSString in "ObjC" `{
		return [self domain];
	`}

	# Wraps: `NSError.code`
	fun code: Int in "ObjC" `{
		return [self code];
	`}

	# Wraps: `NSError.userInfo`
	#fun user_info: NSDictionary in "ObjC" `{
	#	return [self userInfo];
	#`}

	# Wraps: `NSError.localizedDescription`
	fun localized_description: NSString in "ObjC" `{
		return [self localizedDescription];
	`}

	# Wraps: `NSError.localizedFailureReason`
	fun localized_failure_reason: NSString in "ObjC" `{
		return [self localizedFailureReason];
	`}

	# Wraps: `NSError.localizedRecoverySuggestion`
	fun localized_recovery_suggestion: NSString in "ObjC" `{
		return [self localizedRecoverySuggestion];
	`}

	# Wraps: `NSError.localizedRecoveryOptions`
	#fun localized_recovery_options: NSArray in "ObjC" `{
	#	return [self localizedRecoveryOptions];
	#`}

	# Wraps: `NSError.recoveryAttempter`
	fun recovery_attempter: NSObject in "ObjC" `{
		return [self recoveryAttempter];
	`}

	# Wraps: `NSError.helpAnchor`
	fun help_anchor: NSString in "ObjC" `{
		return [self helpAnchor];
	`}
end

# Path to a specific node in a tree of nested array collections
extern class NSIndexPath in "ObjC" `{ NSIndexPath * `}
	super NSObject

	# Wraps: `[self initWithIndex:(NSUInteger)index]`
	new init_with_index(index: Int) in "ObjC" `{
		return [[NSIndexPath alloc] initWithIndex: index];
	`}

	# Wraps: `NSIndexPath.length`
	fun length: Int in "ObjC" `{
		return [self length];
	`}

	# Wraps: `[self indexPathByAddingIndex:(NSUInteger)index]`
	fun index_path_by_adding_index(index: Int): NSIndexPath in "ObjC" `{
		return [self indexPathByAddingIndex: index];
	`}

	# Wraps: `[self indexPathByRemovingLastIndex]`
	fun index_path_by_removing_last_index: NSIndexPath in "ObjC" `{
		return [self indexPathByRemovingLastIndex];
	`}

	# Wraps: `[self indexAtPosition:(NSUInteger)position]`
	fun index_at_position(position: Int): Int in "ObjC" `{
		return [self indexAtPosition: position];
	`}
end

# Interface to the defaults system for an app to customize its behavior to match a user's preferences
extern class NSUserDefaults in "ObjC" `{ NSUserDefaults * `}
	super NSObject

	# Wraps: `[NSUserDefaults standardUserDefaults]`
	new standard_user_defaults in "ObjC" `{
		return [NSUserDefaults standardUserDefaults];
	`}

	# Wraps: `[NSIndexPath stringForKey:]`
	fun string_for_key(key: NSString): NSString in "ObjC" `{
		return [self stringForKey: key];
	`}

	# Wraps: `[NSIndexPath setObject: forKey:]`
	fun set_object(value: NSObject, default_name: NSString)
	in "ObjC" `{
		[self setObject:value forKey:default_name];
	`}
end
lib/cocoa/foundation.nit:17,1--172,3