Cocoa consists of the Foundation Kit, Application Kit, and Core Data frameworks, as included by the Cocoa.h header file, and the libraries and frameworks included by those, such as the C standard library and the Objective-C runtime.[1]
Cocoa applications are typically developed using the development tools provided by Apple, specifically Xcode (formerly Project Builder) and Interface Builder (now part of Xcode), using the programming languagesObjective-C or Swift. However, the Cocoa programming environment can be accessed using other tools. It is also possible to write Objective-C Cocoa programs in a simple text editor and build it manually with GNU Compiler Collection (GCC) or Clang from the command line or from a makefile.
For end users, Cocoa applications are those written using the Cocoa programming environment. Such applications usually have a familiar look and feel, since the Cocoa programming environment provides a lot of common UI elements (such as buttons, scroll bars, etc.), and automates many aspects of an application to comply with Apple's human interface guidelines.
Cocoa continues the lineage of several software frameworks (mainly the App Kit and Foundation Kit) from the NeXTSTEP and OpenStep programming environments developed by NeXT in the 1980s and 1990s. Apple acquired NeXT in December 1996, and subsequently went to work on the Rhapsody operating system that was to be the direct successor of OpenStep. It was to have had an emulation base for classic Mac OS applications, named Blue Box. The OpenStep base of libraries and binary support was termed Yellow Box. Rhapsody evolved into Mac OS X, and the Yellow Box became Cocoa. Thus, Cocoa classes begin with the letters NS, such as NSString or NSArray. These stand for the original proprietary term for the OpenStep framework, NeXTSTEP.[2]
Much of the work that went into developing OpenStep was applied to developing Mac OS X, Cocoa being the most visible part. However, differences exist. For example, NeXTSTEP and OpenStep used Display PostScript for on-screen display of text and graphics, while Cocoa depends on Apple's Quartz (which uses the Portable Document Format (PDF) imaging model, but not its underlying technology). Cocoa also has a level of Internet support, including the NSURL and WebKitHTML classes, and others, while OpenStep had only rudimentary support for managed network connections via NSFileHandle classes and Berkeley sockets.
The API toolbox was originally called “Yellow Box” and was renamed to Cocoa - a name that had been already trademarked by Apple. Apple's Cocoa trademark had originated as the name of a multimedia project design application for children. The name was intended to evoke "Java for kids", as it ran embedded in web pages.[3] The original "Cocoa" program was discontinued following the return of Steve Jobs to Apple. At the time, Java was a big focus area for the company, so “Cocoa” was used as the new name for “Yellow Box” because, in addition to the native Objective-C usage, it could also be accessed from Java via a bridging layer.[4] Even though Apple discontinued support for the Cocoa Java bridge, the name continued and was even used for the Cocoa Touch API.
Memory management
One feature of the Cocoa environment is its facility for managing dynamically allocated memory. Foundation Kit's NSObject class, from which most classes, both vendor and user, are derived, implements a reference counting scheme for memory management. Objects that derive from the NSObject root class respond to a retain and a release message, and keep a retain count. A method titled retainCount exists, but contrary to its name, will usually not return the exact retain count of an object. It is mainly used for system-level purposes. Invoking it manually is not recommended by Apple.
A newly allocated object created with alloc or copy has a retain count of one. Sending that object a retain message increments the retain count, while sending it a release message decrements the retain count. When an object's retain count reaches zero, it is deallocated by a procedure similar to a C++ destructor. dealloc is not guaranteed to be invoked.
Starting with Objective-C 2.0, the Objective-C runtime implemented an optional garbage collector, which is now obsolete and deprecated in favor of Automatic Reference Counting (ARC). In this model, the runtime turned Cocoa reference counting operations such as "retain" and "release" into no-ops. The garbage collector does not exist on the iOS implementation of Objective-C 2.0. Garbage collection in Objective-C ran on a low-priority background thread, and can halt on Cocoa's user events, with the intention of keeping the user experience responsive. The legacy garbage collector is still available on Mac OS X version 10.13, but no Apple-provided applications use it.
In 2011, the LLVM compiler introduced Automatic Reference Counting (ARC), which replaces the conventional garbage collector by performing static analysis of Objective-C source code and inserting retain and release messages as necessary.
Main frameworks
Cocoa consists of three Objective-C object libraries called frameworks. Frameworks are functionally similar to shared libraries, a compiled object that can be dynamically loaded into a program's address space at runtime, but frameworks add associated resources, header files, and documentation. The Cocoa frameworks are implemented as a type of bundle, containing the aforementioned items in standard locations.
Foundation Kit (Foundation), first appeared in Enterprise Objects Framework on NeXTSTEP 3.[5] It was developed as part of the OpenStep work, and subsequently became the basis for OpenStep's AppKit when that system was released in 1994. On macOS, Foundation is based on Core Foundation. Foundation is a generic object-oriented library providing string and value manipulation, containers and iteration, distributed computing, event loops (run loops), and other functions that are not directly tied to the graphical user interface. The "NS" prefix, used for all classes and constants in the framework, comes from Cocoa's OPENSTEP heritage, which was jointly developed by NeXT and Sun Microsystems.
Application Kit (AppKit) is directly descended from the original NeXTSTEP Application Kit. It contains code programs can use to create and interact with graphical user interfaces. AppKit is built on top of Foundation, and uses the same NS prefix.
Core Data is the object persistence framework included with Foundation and Cocoa and found in Cocoa.h.[1]
A key part of the Cocoa architecture is its comprehensive views model. This is organized along conventional lines for an application framework, but is based on the Portable Document Format (PDF) drawing model provided by Quartz. This allows creating custom drawing content using PostScript-like drawing commands, which also allows automatic printer support and so forth. Since the Cocoa framework manages all the clipping, scrolling, scaling and other chores of drawing graphics, the programmer is freed from implementing basic infrastructure and can concentrate on the unique aspects of an application's content.
The Smalltalk teams at Xerox PARC eventually settled on a design philosophy that led to easy development and high code reuse. Named model–view–controller (MVC), the concept breaks an application into three sets of interacting object classes:
Model classes represent problem domain data and operations (such as lists of people/departments/budgets; documents containing sections/paragraphs/footnotes of stylized text).
View classes implement visual representations and affordances for human-computer interaction (such as scrollable grids of captioned icons and pop-up menus of possible operations).
Controller classes contain logic that surfaces model data as view representations, maps affordance-initiated user actions to model operations, and maintains state to keep the two synchronized.
Cocoa's design is a fairly, but not absolutely strict application of MVC principles. Under OpenStep, most of the classes provided were either high-level View classes (in AppKit) or one of a number of relatively low-level model classes like NSString. Compared to similar MVC systems, OpenStep lacked a strong model layer. No stock class represented a "document," for instance. During the transition to Cocoa, the model layer was expanded greatly, introducing a number of pre-rolled classes to provide functionality common to desktop applications.
In Mac OS X 10.3, Apple introduced the NSController family of classes, which provide predefined behavior for the controller layer. These classes are considered part of the Cocoa Bindings system, which also makes extensive use of protocols such as Key-Value Observing and Key-Value Binding. The term 'binding' refers to a relationship between two objects, often between a view and a controller. Bindings allow the developer to focus more on declarative relationships rather than orchestrating fine-grained behavior.
With the arrival of Mac OS X 10.4, Apple extended this foundation further by introducing the Core Data framework, which standardizes change tracking and persistence in the model layer. In effect, the framework greatly simplifies the process of making changes to application data, undoing changes when necessary, saving data to disk, and reading it back in.
In providing framework support for all three MVC domains, Apple's goal is to reduce the amount of boilerplate or "glue" code that developers have to write, freeing up resources to spend time on application-specific features.
Late binding
In most object-oriented languages, calls to methods are represented physically by a pointer to the code in memory. This restricts the design of an application since specific command handling classes are needed, usually organized according to the chain-of-responsibility pattern. While Cocoa retains this approach for the most part, Objective-C's late binding opens up more flexibility.
Under Objective-C, methods are represented by a selector, a string describing the method to call. When a message is sent, the selector is sent into the Objective-C runtime, matched against a list of available methods, and the method's implementation is called. Since the selector is text data, this lets it be saved to a file, transmitted over a network or between processes, or manipulated in other ways. The implementation of the method is looked up at runtime, not compile time. There is a small performance penalty for this,[6] but late binding allows the same selector to reference different implementations.
By a similar token, Cocoa provides a pervasive data manipulation method called key-value coding (KVC).[7] This allows a piece of data or property of an object to be looked up or changed at runtime by name. The property name acts as a key to the value. In traditional languages, this late binding is impossible. KVC leads to great design flexibility. An object's type need not be known, yet any property of that object can be discovered using KVC. Also, by extending this system using something Cocoa terms key-value observing (KVO), automatic support for undo-redo is provided.
Late static binding is a variant of binding somewhere between static and dynamic binding. The binding of names before the program is run is called static (early); bindings performed as the program runs are dynamic (late or virtual).
Rich objects
One of the most useful features of Cocoa is the powerful base objects the system supplies. As an example, consider the Foundation classes NSString and NSAttributedString, which provide Unicodestrings, and the NSText system in AppKit, which allows the programmer to place string objects in the GUI.
NSText and its related classes are used to display and edit strings. The collection of objects involved permit an application to implement anything from a simple single-line text entry field to a complete multi-page, multi-column text layout schema, with full professional typography features such as kerning, ligatures, running text around arbitrary shapes, rotation, full Unicode support, and anti-aliasedglyph rendering. Paragraph layout can be controlled automatically or by the user, using a built-in "ruler" object that can be attached to any text view. Spell checking is automatic, using a system-wide set of language dictionaries. Unlimited undo/redo support is built in. Using only the built-in features, one can write a text editor application in as few as 10 lines of code. With new controller objects, this may fall towards zero.
When extensions are needed, Cocoa's use of Objective-C makes this a straightforward task. Objective-C includes the concept of "categories," which allows modifying existing class "in-place". Functionality can be accomplished in a category without any changes to the original classes in the framework, or even access to its source. In other common languages, this same task requires deriving a new subclass supporting the added features, and then replacing all instances of the original class with instances of the new subclass.
Implementations and bindings
The Cocoa frameworks are written in Objective-C. Java bindings for the Cocoa frameworks (termed the Java bridge) were also made available with the aim of replacing Objective-C with a more popular language[8] but these bindings were unpopular among Cocoa developers and Cocoa's message passing semantics did not translate well to a statically-typed language such as Java.[9] Cocoa's need for runtime binding means many of Cocoa's key features are not available with Java. In 2005, Apple announced that the Java bridge was to be deprecated, meaning that features added to Cocoa in macOS versions later than 10.4 would not be added to the Cocoa-Java programming interface.
Originally, AppleScript Studio could be used to develop simpler Cocoa applications.[11] However, as of Snow Leopard, it has been deprecated. It was replaced with AppleScriptObjC, which allows programming in AppleScript, while using Cocoa frameworks.[12]
A Ruby language implementation named MacRuby, which removes the need for a bridge mechanism, was formerly developed by Apple, while Nu is a Lisp-like language that uses the Objective-C object model directly, and thus can use the Cocoa frameworks without needing a binding.
Other implementations
There are also open source implementations of major parts of the Cocoa framework, such as GNUstep and Cocotron,[16] which allow cross-platform Cocoa application development to target other operating systems, such as Microsoft Windows and Linux.
^"Using the Java Bridge"(PDF). Apple Inc.Because Java is a strongly typed language, it requires more information about the classes and interfaces it manipulates at compile time. Therefore, before using Objective-C classes as Java ones, a description of them has to be written and compiled.
Mary-Lousie ParkerMary Louise Parker (2008)LahirMary-Louise Parker2 Agustus 1964 (umur 59)Fort Jackson, Carolina Selatan, A.S.PekerjaanAktris, PenulisTahun aktif1988-sekarang Mary-Louise Parker (lahir 2 Agustus 1964) adalah seorang aktris dan penulis Amerika. Setelah melakukan debut panggungnya sebagai Rita di sebuah Broadway produksi Craig Lucas' Prelude to a Kiss pada tahun 1990 (yang untuknya dia menerima sebuah Tony Award pencalonan), Parker menjadi terkenal karena peran filmny...
Consolidated Vultee XP-81 adalah pengembangan dari Consolidated Vultee Aircraft Corporation untuk membangun sebuah pesawat tempur kursi tunggal, pendamping jarak jauh yang menggunakan gabungan dari kedua turbojet dan mesin turboprop. Meskipun menjanjikan, kurangnya mesin cocok dipadukan dengan akhir Perang Dunia II. Referensi Ginter, Steve. Consolidated Vultee XP-81 (Air Force Legends Number 214). Simi Valley, California: Ginter Books, 2007. ISBN 0-942612-87-6. Green, William. War Planes of ...
Organic compound containing a –C(=O)OH group COOH redirects here. For the Bulgarian musician, see Ivan Shopov. Not to be confused with Carbolic acid. Structure of a carboxylic acid Carboxylate anion 3D structure of a carboxylic acid In organic chemistry, a carboxylic acid is an organic acid that contains a carboxyl group (−C(=O)−OH)[1] attached to an R-group. The general formula of a carboxylic acid is often written as R−COOH or R−CO2H, sometimes as R−C(O)OH with R re...
Toy Story 3Poster film Toy Story 3SutradaraLee UnkrichProduserDarla K. Anderson, John Lasseter, Lee UnkrichDitulis olehMichael ArndtAndrew StantonPemeran Tom Hanks Tim Allen Joan Cusack Don Rickles Wallace Shawn Annie Potts John Ratzenberger Estelle Harris Ned Beatty Michael Keaton Jodi Benson Timothy Dalton John Morris Penata musikRandy NewmanPenyuntingKen SchretzmannPerusahaanproduksiPixar Animation StudiosDistributorWalt Disney PicturesTanggal rilis 18 Juni 2010 (2010-06-18) Dur...
Pour les articles homonymes, voir Schilling. Taylor Schilling Taylor Schilling en 2014, en promotion pour la série télévisée Orange Is the New Black. Données clés Nom de naissance Taylor Jane Schilling Naissance 27 juillet 1984 (39 ans)Boston, Massachusetts, (États-Unis) Nationalité Américaine Profession Actrice Films notables The Lucky One Séries notables Mercy HospitalOrange Is the New Black modifier Taylor Schilling est une actrice américaine, née le 27 juillet 1984 à Bo...
Jesuit university in Cincinnati, Ohio, US For other uses, see Xavier University (disambiguation). Xavier UniversityLatin: Universitas XaverianaFormer namesAthenaeum(1831-1840)St. Xavier College(1840–1930)MottoVidit Mirabilia Magna (Latin)Motto in EnglishHe has seen great wondersTypePrivate universityEstablished1831; 193 years ago (1831)[1]Religious affiliationRoman Catholic (Jesuit)Academic affiliationsAJCU ACCUGCCCU CIC[2]Endowment$259 million (2021)&...
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: C'est Cheese – news · newspapers · books · scholar · JSTOR (December 2009) (Learn how and when to remove this message) 1995 studio album by The Arrogant WormsC'est CheeseStudio album by The Arrogant WormsReleased1995GenreComedyLabelArrogant Worms Record...
Questa voce sull'argomento centri abitati della provincia di Alessandria è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Alluvioni Pioveracomune LocalizzazioneStato Italia Regione Piemonte Provincia Alessandria AmministrazioneSindacoGiuseppe Francesco Betti (lista civica Più forti insieme) dall'11-6-2018 Data di istituzione1º gennaio 2018 TerritorioCoordinate45°00′N 8°48′E / 45°N 8.8°E45; 8.8 (Alluvion...
Article principal : Futurisme. Affiche d'El Lissitzky pour une production post-révolutionnaire du drame Victoire sur le soleil. La légende multilingue se lit comme suit : Tout est bien qui commence bien et n'est pas fini. Le futurisme russe est un mouvement de poètes et d'artistes russes qui ont adopté les principes du Manifeste du futurisme de Filippo Marinetti, qui préconisait le rejet du passé et une célébration de la vitesse, de la machinerie, de la violence, de la jeune...
Військово-музичне управління Збройних сил України Тип військове формуванняЗасновано 1992Країна Україна Емблема управління Військово-музичне управління Збройних сил України — структурний підрозділ Генерального штабу Збройних сил України призначений для планува...
45°25′N 75°40′W / 45.42°N 75.66°W / 45.42; -75.66 شرطة الخيالة الكندية الملكية Royal Canadian Mounted Police الدولة كندا الإنشاء 1873 المقر الرئيسي مونتريال ، كندا شعار نصي الموقع الرسمي www.rcmp-grc.ca الشارة الدفاع عن القانون الطـائرات هجومية 34 مروحية 10 تعديل مصدري - تعديل شرطة الخي�...
Alphonse Areola Areola with Paris Saint-Germain in 2019Informasi pribadiNama lengkap Alphonse Francis Areola[1]Tanggal lahir 27 Februari 1993 (umur 31)[2]Tempat lahir Paris, FranceTinggi 191 m (626 ft 8 in)[3]Posisi bermain GoalkeeperInformasi klubKlub saat ini West Ham United (on loan from Paris Saint-Germain)Nomor 13Karier junior1999–2006 Petits Anges2006–2012 Paris Saint-Germain2008–2009 → INF Clairefontaine (loan)Karier senior*Tahun Tim...
Дневник доктора Зайцевой Жанр драмеди Создатель Бора Дагтекин Режиссёры Валерия Ивановская, Александр Герцвольф, Сергей Кобзев Сценаристы Иван Шишман, Алина Крупнова, Инна Оркина, Александр Герцвольф В главных ролях Яна Крайнова Илья Любимов Павел Трубинер Елена Сафон...
Perbandingan unit luas Unit SI 1 ca 1 m² 1 a 100 m² 1 ha 10.000 m² 100 ha 1 km² Perbandingan non-SI Non-SI Metrik 0,3861 mi² 1 km² 2,471 acre 1 ha 107.639 kaki² 1 ha 1 mi² 259,0 ha 1 acre 0,4047 ha HektareVisualisasi satu hektareInformasi umumSistem satuanSatuan non-SI yang bisa digunakan bersama SIBesaranLuasSimbolhadalam Satuan pokok SI:1 ha = 104 m2 Hektare (Disingkat ha) merupakan satuan luas yang umum dipakai untuk menyatakan luas tanah yang setara dengan 10.000 m...
Presa di Romaparte del RisorgimentoLa breccia di Porta Pia in una foto di Lodovico TuminelloData20 settembre 1870 LuogoRoma CausaQuestione romana EsitoVittoria italiana Modifiche territorialiAnnessione dello Stato Pontificio al Regno d'Italia Schieramenti Italia Stato PontificioVolontari di vari Paesi d'Europa Comandanti Raffaele Cadorna Hermann Kanzler Effettivi6500013624Pontifici: 8300Volontari: 5324 Perdite32 morti143 feriti15 morti68 feriti Voci di battaglie presenti su ...
John Michael HigginsHiggins tahun 2018Lahir12 Februari 1963 (umur 61)Boston, Massachusetts, Amerika SerikatPekerjaanAktor, komedian, pembawa acaraTahun aktif1985–sekarangSuami/istriMargaret Welsh (m. 2003)Anak2 John Michael Higgins (lahir 12 Februari 1963) adalah aktor dan komedian asal Amerika Serikat.[1] Ia dikenal karena perannya sebagai David Letterman dalam mokumenter HBO, The Late Shift, dan peran utama dalam seri versi Amerika Serikat...
Executive cabinet office of the federal government of Brazil, responsible for security/defense This article relies largely or entirely on a single source. Relevant discussion may be found on the talk page. Please help improve this article by introducing citations to additional sources.Find sources: Institutional Security Bureau – news · newspapers · books · scholar · JSTOR (March 2012) Institutional Security BureauPortuguese: Gabinete de Segurança Ins...
Conquest of northern Ethiopian Empire region (now Eritrea) by Ottomans beginning 1557For other wars between the Ethiopian and Ottoman Empires, see Ottoman–Ethiopian War.Ottoman conquest of HabeshPart of the Expansion of the Ottoman EmpireThe Ottoman Empire in 1609 with the Eyalet highlightedDate1554/1557–1589LocationEritreaResult Ottoman victoryTerritorialchanges Annexation of the Eritrean coastline excluding Beilul[1]Belligerents Ethiopian Empire Ottoman EmpireMedri Bahri A...
The return to initial themes in a composition Recapitulation. Haydn's Sonata in G Major, Hob. XVI: G1, I, mm. 58-80 Playⓘ.[1] In music theory, the recapitulation is one of the sections of a movement written in sonata form. The recapitulation occurs after the movement's development section, and typically presents once more the musical themes from the movement's exposition. This material is most often recapitulated in the tonic key of the movement, in such a way that it reaffirms that...