Objective C项目的命名有多长

LongestCocoa

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

《Objective C项目的命名有多长》

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项目中最长的标识符名称是什么呢?

编撰 SegmentFault

    原文作者:weakish
    原文地址: https://segmentfault.com/a/1190000000370048
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞