Cocoa中缺少什么? [英] What's missing in Cocoa?

查看:196
本文介绍了Cocoa中缺少什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你可以添加任何东西到Cocoa,它会是什么?有没有任何功能,主要或次要,你会说在Cocoa丢失。

If you could add anything to Cocoa, what would it be? Are there any features, major or minor, that you would say are missing in Cocoa. Perhaps there is a wheel you have had to invent over and over because of an omission in the frameworks?

推荐答案


    可能有一个轮子,你必须一遍又一遍地发明
  • 内置的正则表达式支持(a RegexKit )将极为方便。 NSRegularExpression在iOS 4.0+上可用,但在Mac OS X上仍然不可用。

    • Built-in regular expression support (a la RegexKit) would be extremely handy. NSRegularExpression is available on iOS 4.0+, but it is still not available on Mac OS X yet.

      从大文本逐步读取NSString对象的简单方法文件,而不将整个东西加载到内存中。 (NSInputStream和NSFileHandle只是不测量。)

      An easy way to progressively read NSString objects from a large text file without loading the entire thing into memory. (NSInputStream and NSFileHandle just don't measure up for that.)

      可以选择使NSSet / NSMutableSet / NSCountedSet按排序顺序存储和枚举对象像二叉搜索树)一定会受到欢迎。同样的Cocoa数组 - 目前我不得不调用 - [NSArray sortedArrayUsingSelector:] - [NSMutableArray sortUsingSelector:] 获取排序数组,对于集合,我必须先创建数组。

      The ability to optionally make NSSet/NSMutableSet/NSCountedSet store and enumerate objects in sorted order (like a binary search tree) would certainly be welcome. Same goes for Cocoa arrays — currently I have to call something like -[NSArray sortedArrayUsingSelector:] or -[NSMutableArray sortUsingSelector:] to get a sorted array, and for sets I have to create the array first.

      堆/优先级队列。围绕 CFBinaryHeap (这绝对不是那么容易使用)的Cocoa包装器

      A heap / priority queue. A Cocoa wrapper around CFBinaryHeap (which is definitely not as easy to use as Cocoa collections) would probably work.

      可以为每个键存储多个值的字典,通常称为 multiset 。 NSCountedSet几乎是一个multiset / bag,它会很好,对于键值关联(NSMultiDictionary?),而不必自己滚动。

      A dictionary that can store multiple values for each key, commonly known as a multiset. NSCountedSet is pretty much a multiset/bag, and it would be nice to have the same for key-value associations (NSMultiDictionary?) instead of having to roll my own.

      FSEvents 的友好包装器。 (CFFileDescriptor执行一些工作,但不是Cocoa-easy。)

      A friendly wrapper for FSEvents. (CFFileDescriptor does some of the work, but it's not Cocoa-easy.)

      一种从格式字符串和对象数组创建NSString的方法不只是varargs)。 此SO回答显示了一个示例。

      A method for creating an NSString from a format string and an array of objects (not just varargs). This SO answer shows an example. Getting it to work with primitives would be tricky... Maybe an NSPointerArray?

      一致的集中式API可以简化格式化(和解析)各种电话号码的语言环境。目前,您必须使用NSNumberFormatter(或NSScanner)滚动您自己的,并且该过程是乏味和容易出错的。 (例如,请参见 NSNumberFormatter格式化美国电话号码从NSString中删除所有数字。)

      Consistent, centralized APIs that simplify formatting (and parsing) phone numbers for a variety of locales. Currently you have to roll your own with an NSNumberFormatter (or NSScanner), and the process is tedious and error-prone. (For example, see NSNumberFormatter to format US Telephone Numbers and Remove all but numbers from NSString.)

      一个各种各样的数据结构的粉丝,虽然Cocoa的简单性比一些语言。

      Of course, I'm definitely a fan of a wide variety of data structures in general, although Cocoa's simplicity is refreshing compared with some languages.

      这篇关于Cocoa中缺少什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆