コード例 #1
0
    def _addId(self, id_, type_):
        targetDict = None
        suffixes = [ 'ID', 'Id', 'Identifier' ]

        if type_ == self.SEGUE:
            targetDict = self.segues
            suffixes.append('Segue')
        elif type_ == self.VIEW_CONTROLLER:
            targetDict = self.viewControllers
            suffixes.extend(['ViewController', 'Controller', 'VC'])
        elif type_ == self.REUSE:
            targetDict = self.reusables
            suffixes.append('Reuse')
        elif type_ == self.RESTORATION:
            targetDict = self.restorables
            suffixes.append('Restoration')

        variableName = lib.variableNameForString(id_, self._defaultPrefixes, suffixes)
        targetDict[variableName] = id_
コード例 #2
0
def headerAndImpContentsForCatalog(catalogDir, classPrefix):
    imageNames = imageNamesInCatalog(catalogDir)
    if not imageNames:
        return ([], [])

    className = classNameForCatalog(catalogDir, classPrefix)

    hLines = ['@interface {}: NSObject\n'.format(className)]
    mLines = ['@implementation {}\n'.format(className)]

    for imageName in imageNames:
        identifier = lib.variableNameForString(imageName)
        hLines.append('+(UIImage *)' + identifier + ';')
        mLines.append('+(UIImage *)' + identifier + ' { return [UIImage imageNamed:@"' + imageName + '"]; }')

    hLines.append('\n@end')
    mLines.append('\n@end')

    return ('\n'.join(hLines), '\n'.join(mLines))
コード例 #3
0
    def __init__(self, storyboardName, classPrefix):
        self.name = storyboardName
        self.classPrefix = classPrefix
        self.segues = {}
        self.viewControllers = {}
        self.reusables = {}
        self.restorables = {}

        self._defaultPrefixes = [ classPrefix, storyboardName, 'Storyboard' ]
        if storyboardName.endswith('Storyboard'):
            self._defaultPrefixes.append(storyboardName[:-10])

        self.className = lib.variableNameForString(storyboardName, [ classPrefix ], [ 'Storyboard' ], lower = False)
        self._defaultPrefixes.append(self.className)

        if classPrefix:
            self.className = classPrefix + self.className
            self._defaultPrefixes.append(self.className)

        self.className += 'StoryboardIDs'
コード例 #4
0
    def _addId(self, id_, type_):
        targetDict = None
        suffixes = ['ID', 'Id', 'Identifier']

        if type_ == self.SEGUE:
            targetDict = self.segues
            suffixes.append('Segue')
        elif type_ == self.VIEW_CONTROLLER:
            targetDict = self.viewControllers
            suffixes.extend(['ViewController', 'Controller', 'VC'])
        elif type_ == self.REUSE:
            targetDict = self.reusables
            suffixes.append('Reuse')
        elif type_ == self.RESTORATION:
            targetDict = self.restorables
            suffixes.append('Restoration')

        variableName = lib.variableNameForString(id_, self._defaultPrefixes,
                                                 suffixes)
        targetDict[variableName] = id_
コード例 #5
0
    def __init__(self, storyboardName, classPrefix):
        self.name = storyboardName
        self.classPrefix = classPrefix
        self.segues = {}
        self.viewControllers = {}
        self.reusables = {}
        self.restorables = {}

        self._defaultPrefixes = [classPrefix, storyboardName, 'Storyboard']
        if storyboardName.endswith('Storyboard'):
            self._defaultPrefixes.append(storyboardName[:-10])

        self.className = lib.variableNameForString(storyboardName,
                                                   [classPrefix],
                                                   ['Storyboard'],
                                                   lower=False)
        self._defaultPrefixes.append(self.className)

        if classPrefix:
            self.className = classPrefix + self.className
            self._defaultPrefixes.append(self.className)

        self.className += 'StoryboardIDs'
コード例 #6
0
def classNameForCatalog(catalogDir, classPrefix):
    name = lib.bareFilename(catalogDir)
    return classPrefix + lib.variableNameForString(name, [classPrefix], ['AssetCatalog', 'Catalog'], lower = False) + 'Catalog'
コード例 #7
0
def classNameForCatalog(catalogDir, classPrefix):
    name = lib.bareFilename(catalogDir)
    return classPrefix + lib.variableNameForString(name, [classPrefix],
                                                   ['AssetCatalog', 'Catalog'],
                                                   lower=False) + 'Catalog'