Table of Contents

Alle unsere Objective-C Klassen verwenden einen einheitlichen Style.

Protokolle

Für Protokolle verwenden wir folgenden Style:

ProtocolTemplate
/*
 * Copyright 2018 SIB Visions GmbH
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 *
 * History
 * 
 * dd.MM.yyyy - [XX] - creation
 */
 
/*!
  @protocol Foo
  @abstract Protocol implemented by Bar.
  @discussion That's what they do. 
*/
@protocol Foo
 
#pragma mark -
#pragma mark Required
 
/*!
  @method requiredMethod:
  @abstract Validates the specified item.
  @param pItem The item to be validated.
*/
- (void)requiredMethod:(id) pItem;
 
/*!
  @method anotherRequiredMethod:
  @abstract Applies validation rules.
*/
- (void)anotherRequiredMethod;
 
#pragma mark -
#pragma mark Optional
 
@optional
 
/*!
  @method anOptionalMethod:
  @abstract Checks optional things.
*/
- (void)anOptionalMethod;
 
/*!
  @method anotherOptionalMethod:
  @abstract Checks another optional things.
*/
- (void)anotherOptionalMethod;
 
@end

Folgende Regeln werden durch diese Vorlage definiert:

Interfaces

Für Interfaces (.h files) verwenden wir folgenden Style:

InterfaceTemplate
/*
 * Copyright 2018 SIB Visions GmbH
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 *
 * History
 * 
 * dd.MM.yyyy - [XX] - creation
 */
 
#import "Bar.h"
 
/*!
  @class Foo
  @abstract Foo provides a UI element.
  @discussion A Foo object is a simple view that can do two things:  Jump, Run. 
*/
@interface Foo : Bar
{
    #pragma mark -
    #pragma mark Instance variable declarations
 
    @private 
 
    /*! @var value the value of foo. */
    float value;
}
 
#pragma mark -
#pragma mark Property declarations
 
/*! @property value the value property. */
@property float value;
 
#pragma mark -
#pragma mark Initialization
 
/*!
  @method initWithString:
  @abstract Creates a new foo with string representation of width and height.
  @param pString the width and height
  @result a new Foo instance.
*/
- (id)initWithString:(NSString *)pString;
 
#pragma mark -
#pragma mark Method declarations
 
/*!
  @method concatWidth:height:
  @abstract Concatenates the width and height.
  @param pWidth the width.
  @param pHeight the height.
  @result the string representation.
*/
+ (NSString *)concatWidth:(float)pWidth height:(float):pHeight;
 
/*!
  @method setWidth:height:
  @abstract Sets the foo width and height.
  @param pWidth the width.
  @param pHeight the height.
*/
- (void)setWidth:(float)pWidth height:(float)pHeight;
 
@end

Folgende Regeln werden durch diese Vorlage definiert:

Klassen

Für Klassen (.m files) verwenden wir folgenden Style:

ClassTemplate
/*
 * Copyright 2018 SIB Visions GmbH
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 *
 * History
 * 
 * dd.MM.yyyy - [XX] - creation
 */
 
#import "Foo.h";
 
 
@implementation Foo
 
#pragma mark -
#pragma mark Properties
 
@synthesize value;
 
#pragma mark -
#pragma mark Initialization
 
- (id)initWithString:(NSString *)pString
{
    ...
}
 
#pragma mark -
#pragma mark Method declarations
 
+ (NSString *)concatWidth:(float)pWidth height:(float):pHeight
{
    ...
}
 
- (void)setWidth:(float)pWidth height:(float)pHeight
{
    ...
}
 
@end

Folgende Regeln werden durch diese Vorlage definiert:

Unit Tests

Als Testing Framework kommt OCUnit zum Einsatz.

Für Unit Tests verwenden wir folgenden Style:

TestTemplate
/*
 * Copyright 2018 SIB Visions GmbH
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 *
 * History
 * 
 * dd.MM.yyyy - [XX] - creation
 */
 
#import "Foo.h"
 
 
@implementation FooTest
 
#pragma mark -
#pragma mark Internal methods
 
#pragma mark -
#pragma mark Test methods
 
/*!
  @abstract Tests the init method.
*/
- (void)testInit
{
    ...
}
 
@end

Folgende Regeln werden durch diese Vorlage definiert: