Exemple #1
0
    def objc_signature(self, method):
        '''Return a method signature.'''
        s = []
        if method.is_last:
            s.append('- (RACSignal *)')
        else:
            s.append('- (%s)' % self.objc_type(method.result))
        s.append(method.name)
        
        is_first = True
        colon_index = 0
        for arg in method.args:
            if is_first:
                s.append('With')
                s.append(upper_first(arg.name))
                s.append(':')
                colon_index = ''.join(s).index(':')
                is_first = False
            else:
                s.append('\n')
                spaces = max(colon_index - len(arg.name), 0)
                s.append(' ' * spaces)
                s.append(arg.name)
                s.append(':')

            s.append('(%s)' % self.objc_type(arg.type).strip())
            s.append(arg.name)
        
        return ''.join(s)
Exemple #2
0
 def objc_selector(self, method):
     s = [method.name]
     
     is_first = True
     for arg in method.args:
         if is_first:
             s.append('With')
             s.append(upper_first(arg.name))
             is_first = False
         else:
             s.append(arg.name)
         s.append(':')
     
     return ''.join(s)