Objective C项目的命名有多长

简介: Objective-C程序员一定非常喜欢它详细的描述性命名风格。

LongestCocoa

Objective-C程序员一定非常喜欢它详细的描述性命名风格。

image.png

SoWhatIsTheLongestMethodOrConstantNamesInCocoaFramework? (那么,Cocoa框架中最长的方法名或常量名是什么?)答案是:


  • outputImageProviderFromBufferWithPixelFormat:pixelsWide:pixelsHigh:baseAddress:bytesPerRow:releaseCallback:releaseContext:colorSpace:shouldColorMatch:
  • kCMSampleBufferConduitNotificationParameter_UpcomingOutputPTSRangeMayOverlapQueuedOutputPTSRange


longest.py可以帮你找出Objective-C项目中每种标识符中最长的10个。使用很简单:

git clone https://github.com/Quotation/LongestCocoa

cd LongestCocoa

python longest.py <到Objective-C项目目录的路径>

以下是iPhoneOS的结果:


iPhoneOS armv7

最长的Objective-C接口名

  • [55] AVAssetResourceLoadingContentInformationRequestInternal
  • [49] AVMutableVideoCompositionLayerInstructionInternal
  • [47] AVAssetResourceLoadingContentInformationRequest
  • [45] UICollectionViewFlowLayoutInvalidationContext
  • [45] AVAsynchronousVideoCompositionRequestInternal
  • [44] AVAssetWriterInputPixelBufferAdaptorInternal
  • [44] AVMutableVideoCompositionInstructionInternal
  • [43] AVVideoCompositionCoreAnimationToolInternal
  • [43] AVAssetReaderVideoCompositionOutputInternal
  • [43] AVMetadataMachineReadableCodeObjectInternal


最长的Objective-C协议名

  • [44] UIViewControllerTransitionCoordinatorContext
  • [44] GKFriendRequestComposeViewControllerDelegate
  • [44] AVCaptureAudioDataOutputSampleBufferDelegate
  • [44] AVCaptureVideoDataOutputSampleBufferDelegate
  • [43] GKTurnBasedMatchmakerViewControllerDelegate
  • [42] ABPeoplePickerNavigationControllerDelegate
  • [40] UIViewControllerInteractiveTransitioning
  • [39] UIDocumentInteractionControllerDelegate
  • [38] AVCaptureMetadataOutputObjectsDelegate
  • [38] MFMessageComposeViewControllerDelegate


最长的Objective-C属性名

  • [56] automaticallyEnablesStillImageStabilizationWhenAvailable
  • [54] availableMediaCharacteristicsWithMediaSelectionOptions
  • [49] outputObscuredDueToInsufficientExternalProtection
  • [47] usesExternalPlaybackWhileExternalScreenIsActive
  • [46] automaticallyEnablesLowLightBoostWhenAvailable
  • [46] automaticallyConfiguresApplicationAudioSession
  • [45] requiredPixelBufferAttributesForRenderContext
  • [44] modalPresentationCapturesStatusBarAppearance
  • [42] usesAirPlayVideoWhileAirPlayScreenIsActive
  • [42] providesPresentationContextTransitionStyle


最长的Objective-C方法名

  • [128] initRecurrenceWithFrequency:interval:daysOfTheWeek:daysOfTheMonth:monthsOfTheYear:weeksOfTheYear:daysOfTheYear:setPositions:end:
  • [120] drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:
  • [115] layoutManager:boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:
  • [113] decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:
  • [112] drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:
  • [111] getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes:
  • [108] migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:
  • [104] videoComposition:shouldContinueValidatingAfterFindingInvalidTrackIDInInstruction:layerInstruction:asset:
  • [101] animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:
  • [98] strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:


最长的Objective-C方法名(0/1 参数)

  • [70] automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers
  • [65] navigationControllerPreferredInterfaceOrientationForPresentation:
  • [64] splitViewControllerPreferredInterfaceOrientationForPresentation:
  • [63] pageViewControllerPreferredInterfaceOrientationForPresentation:
  • [61] tabBarControllerPreferredInterfaceOrientationForPresentation:
  • [60] backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:
  • [60] setAutomaticallyEnablesStillImageStabilizationWhenAvailable:
  • [59] generateIdentityVerificationSignatureWithCompletionHandler:
  • [57] recommendedVideoSettingsForAssetWriterWithOutputFileType:
  • [57] recommendedAudioSettingsForAssetWriterWithOutputFileType:


最长的Objective-C函数名

  • [63] CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback
  • [62] CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType
  • [62] CMVideoFormatDescriptionGetExtensionKeysCommonWithImageBuffers
  • [62] MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics
  • [61] CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes
  • [58] CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes
  • [58] CMBufferQueueGetCallbacksForSampleBuffersSortedByOutputPTS
  • [57] ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering
  • [57] vImageMultiDimensionalInterpolatedLookupTable_Planar16Q12
  • [57] vImageAlphaBlend_NonpremultipliedToPremultiplied_ARGB8888


最长的Enum名

  • [41] NSPersistentStoreUbiquitousTransitionType
  • [41] UIPageViewControllerNavigationOrientation
  • [40] UIImagePickerControllerCameraCaptureMode
  • [39] UIPageViewControllerNavigationDirection
  • [38] UIImagePickerControllerCameraFlashMode
  • [38] CBPeripheralManagerAuthorizationStatus
  • [36] NSAttributedStringEnumerationOptions
  • [36] NSURLSessionAuthChallengeDisposition
  • [36] CBPeripheralManagerConnectionLatency
  • [35] UIImagePickerControllerCameraDevice


最长的Enum常量名

  • [64] kCFStreamErrorHTTPSProxyFailureUnexpectedResponseToCONNECTMethod
  • [63] NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted
  • [63] NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication
  • [61] kCMBufferQueueTrigger_WhenDurationBecomesGreaterThanOrEqualTo
  • [61] NSAttributedStringEnumerationLongestEffectiveRangeNotRequired
  • [58] kCMBufferQueueTrigger_WhenDurationBecomesLessThanOrEqualTo
  • [58] kAudioSessionProperty_OverrideCategoryEnableBluetoothInput
  • [57] kCMBufferQueueTrigger_WhenMaxPresentationTimeStampChanges
  • [57] kAudioFileGlobalInfo_AvailableStreamDescriptionsForFormat
  • [57] AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory


最长的变量常量名

  • [96] kCMSampleBufferConduitNotificationParameter_UpcomingOutputPTSRangeMayOverlapQueuedOutputPTSRange
  • [81] kCMTextMarkupAttribute_OrthogonalLinePositionPercentageRelativeToWritingDirection
  • [74] MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification
  • [71] kCMTextMarkupAttribute_TextPositionPercentageRelativeToWritingDirection
  • [66] kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight
  • [64] kCMSampleBufferConduitNotificationParameter_MinUpcomingOutputPTS
  • [64] kCMSampleBufferConduitNotification_UpcomingOutputPTSRangeChanged
  • [64] AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly
  • [64] kCMSampleBufferConduitNotificationParameter_MaxUpcomingOutputPTS
  • [62] NSPersistentStoreDidImportUbiquitousContentChangesNotification

你的Objective-C项目中最长的标识符名称是什么呢?

相关文章
|
算法 iOS开发 开发者
Objective-C 项目重构利器:把项目中的导入依赖(Import Dependancies)图示化
作为开发者,我们都喜欢干净的代码,但实际上我们大部分时间都是和糟糕的代码打交道。这些代码可能是最近写的,也可能是遗留下来的,可能是我们自己写的,可能是其他开发者写的。我们能认出什么是糟糕的代码,因为我们有代码的嗅觉(code smells)。换句话说,关于代码质量的启发式提问。在这些中,我们可以命名我写在这里和这里的"死亡"的代码(dead code),也可以命名紧密耦合(tight coupling)。
165 0
Objective-C 项目重构利器:把项目中的导入依赖(Import Dependancies)图示化
|
JSON API iOS开发
Github上优秀的Objective-C项目简介
<p style="margin-top:0px; margin-bottom:1.1em; color:rgb(54,46,43); font-family:'microsoft yahei'; font-size:14px; line-height:26px"> Github上优秀的Objective-C项目简介</p> <p style="margin-top:0px; marg
2422 0
|
开发者 iOS开发 索引
Objective-C 之优雅的命名-看似简单,实际却很考验开发者的功力
There are only two hard things in Computer Science: cache invalidation and naming things. 在计算机科学中只有两件难事:缓存失效和命名。
1194 0
|
C语言 C++ iOS开发
【《Objective-C基础教程 》笔记ch02】(一)Hello Object-C 项目
一、项目实现步骤。 1、若xcode尚未运行,先启动它。 2、选择Select File --> New --> New Project菜单选项。 3、选择左边OS X下得application,再选中右边的command line tool,点击next。
1021 0
|
5月前
|
安全 编译器 Swift
IOS开发基础知识: 对比 Swift 和 Objective-C 的优缺点。
IOS开发基础知识: 对比 Swift 和 Objective-C 的优缺点。
317 2
|
3月前
|
开发工具 iOS开发 容器
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
iOS Objective-C 应用连接Azure Storage时,若不关闭账号的匿名访问,程序能正常运行。但关闭匿名访问后,上传到容器时会出现错误:“Public access is not permitted”。解决方法是将创建容器时的公共访问类型从`AZSContainerPublicAccessTypeContainer`改为`AZSContainerPublicAccessTypeOff`,以确保通过授权请求访问。
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
|
5月前
|
缓存 开发工具 iOS开发
优化iOS中Objective-C代码调起支付流程的速度
优化iOS中Objective-C代码调起支付流程的速度
70 2
|
5月前
|
安全 JavaScript 前端开发
IOS开发基础知识:介绍一下 Swift 和 Objective-C,它们之间有什么区别?
IOS开发基础知识:介绍一下 Swift 和 Objective-C,它们之间有什么区别?
205 0
|
iOS开发 容器
iOS 代码规范格式 Objective-C(上)
iOS 代码规范格式 Objective-C
422 0
iOS 代码规范格式 Objective-C(上)
|
编译器 API iOS开发
iOS 代码规范格式 Objective-C(下)
iOS 代码规范格式 Objective-C(下)
222 0