2009-07-20 14 views

risposta

2

Questo è quello che ho trovato basato su uno che ho trovato molto tempo fa, riscritto in Python e con i miglioramenti che può generare più proprietà contemporaneamente, tra le altre cose.

Genera proprietà per tutte le variabili di istanza selezionate utilizzando (copia) come attributo.

Esistono ancora casi limite con più @interfaces o @implementazioni in un file, nonché alcuni con identificatori insoliti o posizionamento di asterisco (come in * const), ma dovrebbe coprire la maggior parte degli stili di codifica tipici. Sentiti libero di modificare/pubblicare modifiche se risolvi uno di questi casi.

#!/usr/bin/python 

# Takes a header file with one or more instance variables selected 
# and creates properties and synthesize directives for the selected properties. 

# Accepts google-style instance variables with a tailing underscore and 
# creates an appropriately named property without underscore. 

# Entire Document 
# Home Directory 
# Discard Output 
# Display in Alert 

import os 
import re 
import subprocess 

# AppleScripts for altering contents of files via Xcode 
setFileContentsScript = """\ 
on run argv 
    set fileAlias to POSIX file (item 1 of argv) 
    set newDocText to (item 2 of argv) 
    tell application "Xcode" 
     set doc to open fileAlias 
     set text of doc to newDocText 
    end tell 
end run \ 
""" 

getFileContentsScript = """\ 
on run argv 
    set fileAlias to POSIX file (item 1 of argv) 
    tell application "Xcode" 
     set doc to open fileAlias 
     set docText to text of doc 
    end tell 
    return docText 
end run \ 
""" 

# Get variables from Xcode 
headerFileText = """%%%{PBXAllText}%%%""" 
selectionStartIndex = %%%{PBXSelectionStart}%%% 
selectionEndIndex = %%%{PBXSelectionEnd}%%% 
selectedText = headerFileText[selectionStartIndex:selectionEndIndex] 

headerFilePath = """%%%{PBXFilePath}%%%""" 

# Look for an implementation file with .m or .mm extension 
implementationFilePath = headerFilePath[:-1] + "m" 
if not os.path.exists(implementationFilePath): 
    implementationFilePath += "m" 

instanceVariablesRegex = re.compile(
    """^\s*((?:(?:\w+)\s+)*(?:(?:\w+)))""" + # Identifier(s) 
    """([*]?)\\s*""" + # An optional asterisk 
    """(\\w+?)(_?);""", # The variable name 
    re.M) 

# Now for each instance variable in the selected section 
properties = "" 
synthesizes = "" 

for lineMatch in instanceVariablesRegex.findall(selectedText): 
    types = " ".join(lineMatch[0].split()) # Clean up consequtive whitespace 
    asterisk = lineMatch[1] 
    variableName = lineMatch[2] 
    trailingUnderscore = lineMatch[3] 

    pointerPropertyAttributes = "(copy) " # Attributes if variable is pointer 
    if not asterisk: 
     pointerPropertyAttributes = "" 

    newProperty = "@property %s%s %s%s;\n" % (pointerPropertyAttributes, 
              types, 
              asterisk, 
              variableName) 

    # If there's a trailing underscore, we need to let the synthesize 
    # know which backing variable it's using 
    newSynthesize = "@synthesize %s%s;\n" % (variableName, 
              trailingUnderscore and 
              " = %s_" % variableName) 

    properties += newProperty 
    synthesizes += newSynthesize 

# Check to make sure at least 1 properties was found to generate 
if not properties: 
    os.sys.stderr.writelines("No properties found to generate") 
    exit(-1) 

# We want to insert the new properties either immediately after the last 
# existing property or at the end of the instance variable section 
findLastPropertyRegex = re.compile("^@interface.*?{.*?}.*?\\n" + 
            "(?:.*^\\s*@property.*?\\n)?", re.M | re.S) 
headerInsertIndex = findLastPropertyRegex.search(headerFileText).end() 

# Add new lines on either side if this is the only property in the file 
addedNewLine = "\n" 
if re.search("^\s*@property", headerFileText, re.M): 
    # Not the only property, don't add 
    addedNewLine = "" 

newHeaderFileText = "%s%s%s%s" % (headerFileText[:headerInsertIndex], 
           addedNewLine, 
           properties, 
           headerFileText[headerInsertIndex:]) 

subprocess.call(["osascript", 
       "-e", 
       setFileContentsScript, 
       headerFilePath, 
       newHeaderFileText]) 


if not os.path.exists(implementationFilePath): 
    os.sys.stdout.writelines("No implementation file found") 
    exit(0) 

implementationFileText = subprocess.Popen(
    ["osascript", 
    "-e", 
    getFileContentsScript, 
    implementationFilePath], 
    stdout=subprocess.PIPE).communicate()[0] 

# We want to insert the synthesizes either immediately after the last existing 
# @synthesize or after the @implementation directive 
lastSynthesizeRegex = re.compile("^\\s*@implementation.*?\\n" + 
           "(?:.*^\\s*@synthesize.*?\\n)?", re.M | re.S) 

implementationInsertIndex = \ 
    lastSynthesizeRegex.search(implementationFileText).end() 

# Add new lines on either side if this is the only synthesize in the file 
addedNewLine = "\n" 
if re.search("^\s*@synthesize", implementationFileText, re.M): 
    # Not the only synthesize, don't add 
    addedNewLine = "" 

newImplementationFileText = "%s%s%s%s" % \ 
        (implementationFileText[:implementationInsertIndex], 
        addedNewLine, 
        synthesizes, 
        implementationFileText[implementationInsertIndex:]) 

subprocess.call(["osascript", 
       "-e", 
       setFileContentsScript, 
       implementationFilePath, 
       newImplementationFileText]) 

# Switch Xcode back to header file 
subprocess.Popen(["osascript", 
        "-e", 
        getFileContentsScript, 
        headerFilePath], 
       stdout=subprocess.PIPE).communicate() 
+0

Uh, non è vero "sintetizzare", con due e? Suppongo che questo script non possa funzionare correttamente con l'ortografia "synthsize". – n8gray

+0

Sì, grazie per averlo indicato. –

0

Ecco quello che ho scritto ieri per fare le direttive @property prima di imbattersi in questa domanda un paio d'ore più tardi. È un semplice filtro di testo e sarebbe banale estenderlo alle direttive @synthesize (aggiungere una clausola when appropriata all'istruzione case e apportare le aggiunte appropriate alla condizione when block_end) e non molto altro lavoro per estenderlo per gestire più occorrenze di @ implementazione dell'interfaccia/@ in un unico file (tracciando i loro nomi --- può essere fatto attraverso la cattura espressioni regolari, come tutto il resto è nello script):

#! /usr/bin/ruby 

# -------------- Basic Definitions ----------------------------- 

doc = "%%%{PBXFilePath}%%%" 

# regular expressions 

search_exp = /[[:space:]]*([[a-zA-Z0-9]]*)[[:space:]]\*([a-zA-Z0-9]*)/ 
interface_start = /@interface/ 
block_end = /^\}/ 

#initializing variables 

properties_list = [] 
properties_string = "" 
reading_interface = 0 

#---------------- Start Processing ----------------------------- 

file = File.open(doc, "r").readlines 

file.each do |line| 

# capture the regular expression matches only in the 
# interface declaration and print out the matching 
# property declarations 

    case line 

    # start capturing 
    when interface_start 
    reading_interface = 1 
    puts line 

    # capture and keep in properties_list 
    when search_exp 
    if (reading_interface == 1) then 
     data = Regexp.last_match 
     properties_list << data 
    end 
    puts line 

    # unpack properties_list and print out the property 
    # declarations 
    when block_end 
    if (reading_interface == 1) then 
     reading_interface = 0 
     properties_list.each do |pair| 
     properties_string << "@property (readwrite, copy) #{pair[0].lstrip};\n" 
     end 
     puts line 
     puts "\n" + properties_string 
    end 
    else puts line 
    end 

end 

ho eseguito questo con "nessun input" e "sostituire contenuto del documento "come opzioni per I/O nell'editor degli script utente.

1

Ecco lo usercript che attualmente utilizzo: funziona su una variabile di istanza alla volta. Prova a utilizzare il meccanismo di conservazione corretto (i tipi semplici non vengono mantenuti) e crea anche l'istruzione @synthesize nel file di implementazione - al momento non crea ancora istruzioni dealloc per te.

#! /usr/bin/perl -w 

#Input: Selection 
#Directory: Selection 
#Output: Display in Alert 
#Errors: Display in Alert 

use strict; 

# Get the header file contents from Xcode user scripts 
my $headerFileContents = <<'HEADERFILECONTENTS'; 
%%%{PBXAllText}%%% 
HEADERFILECONTENTS 

# Get the indices of the selection from Xcode user scripts 
my $selectionStartIndex = %%%{PBXSelectionStart}%%%; 
my $selectionEndIndex = %%%{PBXSelectionEnd}%%%; 

# Get path of the header file 
my $implementationFilePath = "%%%{PBXFilePath}%%%"; 
my $headerFilePath = $implementationFilePath; 

# Look for an implemenation file with a ".m" or ".mm" extension 
$implementationFilePath =~ s/\.[hm]*$/.m/; 
if (!(-e $implementationFilePath)) 
{ 
    $implementationFilePath =~ s/.m$/.mm/; 
} 

# Handle subroutine to trime whitespace off both ends of a string 
sub trim 
{ 
    my $string = shift; 
    $string =~ s/^\s*(.*?)\s*$/$1/; 
    return $string; 
} 


# Get the selection out of the header file 
my $selectedText = substr $headerFileContents, $selectionStartIndex, ($selectionEndIndex - $selectionStartIndex); 

#my $otherText = substr $headerFileContents, $selectionStartIndex; 
#my $pulledText = ""; 
#if (length($otherText) && $otherText =~ /.*$(^.*;).*/) 
#{ 
# $pulledText = $1; 
#} 
# 
# 
#print $pulledText; 


$selectedText = trim $selectedText; 


my $type = ""; 
my $asterisk = ""; 
my $name = ""; 
my $behavior = ""; 
my $iboutlet = ""; 

# Test that the selection is: 
# At series of identifiers (the type name and access specifiers) 
# Possibly an asterisk 
# Another identifier (the variable name) 
# A semi-colon 
if (length($selectedText) && ($selectedText =~ /([_A-Za-z][_A-Za-z0-9]*\s*)+([\s\*]+)([_A-Za-z][_A-Za-z0-9]*)/)) 
{ 
    $type = $1; 
    $type = trim $type; 
    $asterisk = $2; 
    $asterisk = trim $asterisk; 
    $name = $3; 
    $behavior = ""; 
    if (defined($asterisk) && length($asterisk) == 1) 
    { 
     $behavior = "(nonatomic, retain) "; 
    } 
    else 
    { 
     $behavior = "(nonatomic) "; 
     $asterisk = ""; 
    } 
} 
else 
{ 
    print "Bailing, error in Regex"; 
    exit 1; 
} 

# special case, see if we need to keep around an IBOUTLET declaration. 
if (length($selectedText) && ($selectedText =~ /IBOutlet/)) 
{ 
    $iboutlet = "IBOutlet "; 
} 

# Find the closing brace (end of the class variables section) 
my $remainderOfHeader = substr $headerFileContents, $selectionEndIndex; 
my $indexAfterClosingBrace = $selectionEndIndex + index($remainderOfHeader, "\n}\n") + 3; 
if ($indexAfterClosingBrace == -1) 
{ 
    exit 1; 
} 

# Determine if we need to add a newline in front of the property declaration 
my $leadingNewline = "\n"; 
if (substr($headerFileContents, $indexAfterClosingBrace, 1) eq "\n") 
{ 
    $indexAfterClosingBrace += 1; 
    $leadingNewline = ""; 
} 

# Determine if we need to add a newline after the property declaration 
my $trailingNewline = "\n"; 
if (substr($headerFileContents, $indexAfterClosingBrace, 9) eq "\@property") 
{ 
    $trailingNewline = ""; 
} 

# Create and insert the proper declaration 
my $propertyDeclaration = $leadingNewline . "\@property " . $behavior . $iboutlet . $type . " " . $asterisk . $name . ";\n" . $trailingNewline; 
substr($headerFileContents, $indexAfterClosingBrace, 0) = $propertyDeclaration; 

my $replaceFileContentsScript = <<'REPLACEFILESCRIPT'; 
on run argv 
    set fileAlias to POSIX file (item 1 of argv) 
    set newDocText to (item 2 of argv) 
    tell application "Xcode" 
     set doc to open fileAlias 
     set text of doc to newDocText 
    end tell 
end run 
REPLACEFILESCRIPT 

# Use Applescript to replace the contents of the header file 
# (I could have used the "Output" of the Xcode user script instead) 
system 'osascript', '-e', $replaceFileContentsScript, $headerFilePath, $headerFileContents; 

# Stop now if the implementation file can't be found 
if (!(-e $implementationFilePath)) 
{ 
    exit 1; 
} 

my $getFileContentsScript = <<'GETFILESCRIPT'; 
on run argv 
    set fileAlias to POSIX file (item 1 of argv) 
    tell application "Xcode" 
     set doc to open fileAlias 
     set docText to text of doc 
    end tell 
    return docText 
end run 
GETFILESCRIPT 

# Get the contents of the implmentation file 
open(SCRIPTFILE, '-|') || exec 'osascript', '-e', $getFileContentsScript, $implementationFilePath; 
my $implementationFileContents = do {local $/; <SCRIPTFILE>}; 
close(SCRIPTFILE); 

# Look for the class implementation statement 
if (length($implementationFileContents) && ($implementationFileContents =~ /(\@implementation [_A-Za-z][_A-Za-z0-9]*\n)/)) 
{ 
    my $matchString = $1; 
    my $indexAfterMatch = index($implementationFileContents, $matchString) + length($matchString); 

    # Determine if we want a newline before the synthesize statement 
    $leadingNewline = "\n"; 
    if (substr($implementationFileContents, $indexAfterMatch, 1) eq "\n") 
    { 
     $indexAfterMatch += 1; 
     $leadingNewline = ""; 
    } 

    # Determine if we want a newline after the synthesize statement 
    $trailingNewline = "\n"; 
    if (substr($implementationFileContents, $indexAfterMatch, 11) eq "\@synthesize") 
    { 
     $trailingNewline = ""; 
    } 

    # Create and insert the synthesize statement 
    my $synthesizeStatement = $leadingNewline . "\@synthesize " . $name . ";\n" . $trailingNewline; 
    substr($implementationFileContents, $indexAfterMatch, 0) = $synthesizeStatement; 

    # Use Applescript to replace the contents of the implementation file in Xcode 
    system 'osascript', '-e', $replaceFileContentsScript, $implementationFilePath, $implementationFileContents; 
} 

exit 0; 
0

Accessorizer http://www.kevincallahan.org/software/accessorizer.html fa questa roba e molto di più. Gestisce anche prefissi e suffissi personalizzati (suffissi). Se vuoi il trattino di sottolineatura di Google, ce l'hai. Se vuoi cambiarlo, cambialo al volo - non è necessario modificare gli script. Inoltre, esiste una tabella di default in cui è possibile definire gli identificatori di proprietà predefiniti in base al tipo di ivar passato (copia, conserva, readonly, assegna ecc.). Effettua il rilevamento di IBOutlet e inserisce automaticamente la parola chiave IBOutlet, nils le tue viste per -viewDidUnload, esegue diversi stili di dealloc. Scrive anche tutti quegli accessor hairy per le collezioni (NSMutableArray e NSSet). Archiviazione delle chiavi, vari approcci di blocco, può ordinare la proprietà e sintetizzare blocchi, scrivere codice KVO, codice Singleton, convertire in selettore, generare tag HeaderDoc, NSLog() e altro ancora ... Ha anche una scheda stili flessibile per mettere bretelle su newline o meno, per spaziatura, per nomi di argomenti personalizzati ecc. La maggior parte delle cose viene gestita attraverso i servizi, quindi è sufficiente selezionare il blocco di ivar, premere un tasto o due e il gioco è fatto. Se minimizzi Accessorizer sul dock, la sua interfaccia non viene visualizzata in primo piano, permettendoti di rimanere concentrato su Xcode o su qualsiasi altro editor che supporti i Servizi. Ovviamente, Accessorizer scrive anche accessors espliciti (come in Objective-C 1.0) e consente di sovrascrivere le proprietà - il tutto con un semplice interruttore di un interruttore. Puoi persino personalizzare l'override in base al tipo passato. Guarda i video per vederlo in azione.

2

Questo è uno script python per Xcode 3.2.4 che genera; proprietà dell'interfaccia, sintesi di implementazione e dealloc. Per installare, copia questo script, vai al menu degli script Xcode (dal 2 ° all'ultima) "Modifica script utente ..." Aggiungilo sotto Codice, crea un nuovo nome script e incolla lo script python qui sotto.

Per utilizzare basta selezionare le variabili sotto l'interfaccia @, quindi chiamare questo script. Aggiungerà quindi tutte le proprietà @, nell'implementazione e tutte le @synthesize e dealloc. Non aggiungerà IBOutlet a nessuna delle tue etichette o pulsanti poiché non lo sa, ma questo è facile da aggiungere manualmente.

L'indentazione dello script di seguito è fondamentale, quindi non cambiarlo.

#!/usr/bin/python 


# Takes a header file with one or more instance variables selected 
# and creates properties and synthesize directives for the selected properties. 

# Accepts google-style instance variables with a tailing underscore and 
# creates an appropriately named property without underscore. 

# Xcode script options should be as follows: 
# Entire Document 
# Home Directory 
# Discard Output 
# Display in Alert 

import os 
import re 
import subprocess 

# AppleScripts for altering contents of files via Xcode 
setFileContentsScript = """\ 
on run argv 
set fileAlias to POSIX file (item 1 of argv) 
set newDocText to (item 2 of argv) 
tell application "Xcode" 
set doc to open fileAlias 
set text of doc to newDocText 
end tell 
end run \ 
""" 

getFileContentsScript = """\ 
on run argv 
set fileAlias to POSIX file (item 1 of argv) 
tell application "Xcode" 
set doc to open fileAlias 
set docText to text of doc 
end tell 
return docText 
end run \ 
""" 

# Get variables from Xcode 
headerFileText = """%%%{PBXAllText}%%%""" 
selectionStartIndex = %%%{PBXSelectionStart}%%% 
selectionEndIndex = %%%{PBXSelectionEnd}%%% 
selectedText = headerFileText[selectionStartIndex:selectionEndIndex] 

headerFilePath = """%%%{PBXFilePath}%%%""" 

# Look for an implementation file with .m or .mm extension 
implementationFilePath = headerFilePath[:-1] + "m" 
if not os.path.exists(implementationFilePath): 
implementationFilePath += "m" 

instanceVariablesRegex = re.compile(
"""^\s*((?:(?:\\b\w+\\b)\s+)*(?:(?:\\b\\w+\\b)))\\s*""" + # Identifier(s) 
"""([*]?)\\s*""" + # An optional asterisk 
"""(\\b\\w+?)(_?\\b);""", # The variable name 
re.M) 

# Now for each instance variable in the selected section 
properties = "" 
synthesizes = "" 
deallocs = "" 

for lineMatch in instanceVariablesRegex.findall(selectedText): 
    types = " ".join(lineMatch[0].split()) # Clean up consequtive whitespace 

    asterisk = lineMatch[1] 
    variableName = lineMatch[2] 
    trailingUnderscore = lineMatch[3] 

    pointerPropertyAttributes = "(nonatomic, retain) " # Attributes if variable is pointer 
    if not asterisk: 
     pointerPropertyAttributes = "(nonatomic, assign) " 

    newProperty = "@property %s%s %s%s;\n" % (pointerPropertyAttributes, 
             types, 
             asterisk, 
             variableName) 

    # If there's a trailing underscore, we need to let the synthesize 
    # know which backing variable it's using 
    newSynthesize = "@synthesize %s%s;\n" % (variableName, 
            trailingUnderscore and 
            " = %s_" % variableName) 
    # only do the objects 
    if asterisk: 
     newDealloc = " [%s%s release];\n" % (variableName, 
        trailingUnderscore and 
           " = %s_" % variableName) 
    properties += newProperty 
    synthesizes += newSynthesize 
    # only add if it's an object 
    if asterisk: 
     deallocs += newDealloc 


# Check to make sure at least 1 properties was found to generate 
if not properties: 
    os.sys.stderr.writelines("No properties found to generate") 
    exit(-1) 

# We want to insert the new properties either immediately after the last 
# existing property or at the end of the instance variable section 
findLastPropertyRegex = re.compile("^@interface.*?{.*?}.*?\\n" + 
         "(?:.*^\\s*@property.*?\\n)?", re.M | re.S) 
headerInsertIndex = findLastPropertyRegex.search(headerFileText).end() 

# Add new lines on either side if this is the only property in the file 
addedNewLine = "\n" 
if re.search("^\s*@property", headerFileText, re.M): 
    # Not the only property, don't add 
    addedNewLine = "" 

newHeaderFileText = "%s%s%s%s" % (headerFileText[:headerInsertIndex], 
         addedNewLine, 
         properties, 
         headerFileText[headerInsertIndex:]) 

subprocess.call(["osascript", 
     "-e", 
     setFileContentsScript, 
     headerFilePath, 
     newHeaderFileText]) 


if not os.path.exists(implementationFilePath): 
    os.sys.stdout.writelines("No implementation file found") 
    exit(0) 

implementationFileText = subprocess.Popen(
["osascript", 
"-e", 
getFileContentsScript, 
implementationFilePath], 
stdout=subprocess.PIPE).communicate()[0] 

# We want to insert the synthesizes either immediately after the last existing 
# @synthesize or after the @implementation directive 
lastSynthesizeRegex = re.compile("^\\s*@implementation.*?\\n" + 
         "(?:.*^\\s*@synthesize.*?\\n)?", re.M | re.S) 

implementationInsertIndex = \ 
lastSynthesizeRegex.search(implementationFileText).end() 

# Add new lines on either side if this is the only synthsize in the file 
addedNewLine = "\n" 
if re.search("^\s*@synthesize", implementationFileText, re.M): 
    # Not the only synthesize, don't add 
    addedNewLine = "" 

newImplementationFileText = "%s%s%s%s" % \ 
     (implementationFileText[:implementationInsertIndex], 
     addedNewLine, 
     synthesizes, 
     implementationFileText[implementationInsertIndex:]) 

subprocess.call(["osascript", 
     "-e", 
     setFileContentsScript, 
     implementationFilePath, 
     newImplementationFileText]) 


implementationFileText = subprocess.Popen(
["osascript", 
"-e", 
getFileContentsScript, 
implementationFilePath], 
stdout=subprocess.PIPE).communicate()[0] 

# We want to insert the deallocs either immediately after the last existing 
# [* release] or after the [super dealloc] 
lastDeallocRegex = re.compile("^\\s+\[super dealloc\];?\\n" + 
         "(?:.*^\\s+\[\w release\];?\\n)?", re.M | re.S) 

deallocInsertIndex = \ 
lastDeallocRegex.search(implementationFileText).end() 

addedNewDeallocLine = "\n" 
if re.search("^\s*\[\w release\];?", implementationFileText, re.M): 
# Not the only dealloc, don't add 
addedNewDeallocLine = "" 


newImplementationFileText = "%s%s%s%s" % \ 
     (implementationFileText[:deallocInsertIndex], 
      addedNewDeallocLine, 
      deallocs, 
      implementationFileText[deallocInsertIndex:]) 

subprocess.call(["osascript", 
       "-e", 
       setFileContentsScript, 
       implementationFilePath, 
       newImplementationFileText])  

# Switch Xcode back to header file 
subprocess.Popen(["osascript", 
     "-e", 
     getFileContentsScript, 
     headerFilePath], 
     stdout=subprocess.PIPE).communicate() 
1

Whoa, c'è un sacco di script pazzeschi che si accendono qui.

Come di Xcode 4.4 (forse prima) ... I IVAR s saranno automaticamente sintetizzato .. Per esempio ..

@property (assign) BOOL automatically; 
@property (strong) NSArray *believeDat; 

possono essere "accessored" via

self.automatically = YES; 

e modifica la variabile di istanza direttamente tramite l'auto-generato-con-leading-underscore come ..

_believeDat = @["thank you, jesus", @"mary poopins"]; 

no @synthesize necessario.

Per quanto riguarda l'immissione rapida e semplice di tale @property ... trascinare quanto segue, uno alla volta, nella libreria "Snippet di codice" .. ed è possibile assegnare scorciatoie da tastiera per inserire questi punti di salto per l'inserimento del proprietà più rapidamente. Io uso RRR per gli oggetti e aaa per le primitive .. ma questo è solo me ..

@property (nonatomic, assign) <#type#> <#name#>;

@property (nonatomic, retain) <#type#> *<#name#>;

ultimo ma non meno importante, e alcuni mi può chiamare pazzo .. ma butto i seguenti macro nel mio .pch per accelerare ulteriormente, chiarire e portare gradita brevità al processo .. tutti i comuni disclaimer macro si applicano ...

#define RONLY readonly 
#define RDWRT readwrite 
#define NATOM nonatomic 
#define STRNG strong 
#define ASS assign 
#define CP copy 
#define SET setter 
#define GET getter 

con analoga struttura #define s per le classi di Apple (#define NSA NSArray \ #define NSS NSString), questo rende le cose più facili da leggere, e più veloce per entrare (per me), che sembra ...

@property (NATOM, STRNG) NSA* fonts; 
@property (NATOM, STRNG) NSS* cachedPath; 
+0

Quindi vuoi dire che tutti i @property hanno sintetizzato automaticamente? Non c'è bisogno di definire sintetizzare? – Dejell

Problemi correlati