init(object: Any)
init(objects: UnsafePointer<AnyObject>, count: Int)
func adding(Any) -> Set<AnyHashable>
func addingObjects (from: Set<AnyHashable>) -> Set<AnyHashable>
func addingObjects (from: [Any]) -> Set<AnyHashable>
Availability 有効性
Technology
class NSSet : NSObject
The NSSet
, NSMutable
, and NSCounted
classes declare the programmatic interface to an unordered collection of objects.
NSSet
、NSMutable
、そしてNSCounted
クラスは、オブジェクトの順番付けられないコレクションに対するプログラムインターフェイスを宣言します。
NSSet
declares the programmatic interface for static sets of distinct objects. You establish a static set’s entries when it’s created, and can’t modify the entries after that. NSMutable
, on the other hand, declares a programmatic interface for dynamic sets of distinct objects. A dynamic — or mutable — set allows the addition and deletion of entries at any time, automatically allocating memory as needed.
Use sets as an alternative to arrays when the order of elements isn’t important and you need to consider performance in testing whether the set contains an object. With an array, testing for membership is slower than with sets.
NSSet
is “toll-free bridged” with its Core Foundation counterpart, CFSet
. See Toll-Free Bridging for more information on toll-free bridging.
トールフリーブリッジに関する更なる情報としてToll-Free Bridgingを見てください。
In Swift, use this class instead of a Set
constant in cases where you require reference semantics.
There should be little need of subclassing. サブクラスを作る必要はほとんどないはずです。 If you need to customize behavior, it’s often better to consider composition instead of subclassing.
In a subclass, you must override all of its primitive methods: サブクラスにおいて、あなたはそれの根本的メソッドの全てをオーバーライドする必要があります:
Before making a custom class of NSSet
, investigate NSHash
and the corresponding Core Foundation type, CFSet. Because NSSet
and CFSet are “toll-free bridged,” you can substitute a CFSet object for a NSSet
object in your code (with appropriate casting). Although they’re corresponding types, CFSet and NSSet
don’t have identical interfaces or implementations, and you can sometimes do things with CFSet that you can’t easily do with NSSet
.
If the behavior you want to add supplements that of the existing class, you could write a category on NSSet
. Keep in mind, however, that this category affects all instances of NSSet
that you use, and this might have unintended consequences. Alternatively, you could use composition to achieve the desired behavior.
あるいは、あなたは望む挙動を達成するためにコンポジション(合成)を使うことができます。
init(object: Any)
init(objects: UnsafePointer<AnyObject>, count: Int)
func adding(Any) -> Set<AnyHashable>
func addingObjects (from: Set<AnyHashable>) -> Set<AnyHashable>
func addingObjects (from: [Any]) -> Set<AnyHashable>
init(array: [Any])
init(objects: UnsafePointer<AnyObject>?, count: Int)
init(set: Set<AnyHashable>)
init(set: Set<AnyHashable>, copyItems : Bool)
init()
var count: Int
var allObjects : [Any]
func anyObject () -> Any?
nil
if the set contains no objects.
集合の中のオブジェクトの1つを返します、または集合がオブジェクトを含まないならばnil
。
func contains(Any) -> Bool
func filtered(using: NSPredicate) -> Set<AnyHashable>
func member(Any) -> Any?
func objectEnumerator () -> NSEnumerator
func enumerateObjects ((Any, UnsafeMutablePointer<ObjCBool>) -> Void)
func enumerateObjects (options: NSEnumerationOptions, using: (Any, UnsafeMutablePointer<ObjCBool>) -> Void)
func objects(passingTest : (Any, UnsafeMutablePointer<ObjCBool>) -> Bool) -> Set<AnyHashable>
func objects(options: NSEnumerationOptions, passingTest : (Any, UnsafeMutablePointer<ObjCBool>) -> Bool) -> Set<AnyHashable>
func isSubset (of: Set<AnyHashable>) -> Bool
func intersects(Set<AnyHashable>) -> Bool
func isEqual (to: Set<AnyHashable>) -> Bool
func value(forKey : String) -> Any
valueForKey:
on each of the receiving set's members.
ある集合を返します、valueForKey:
を受け手側の集合のもつメンバのそれぞれで発動する結果を含んでいます。
func setValue (Any?, forKey : String)
setValue:forKey:
on each of the set’s members.
setValue:forKey:
を集合のもつメンバのそれぞれで発動します。
func sortedArray (using: [NSSortDescriptor]) -> [Any]
func addObserver (NSObject, forKeyPath : String, options: NSKeyValueObservingOptions, context: UnsafeMutableRawPointer?)
func removeObserver (NSObject, forKeyPath : String, context: UnsafeMutableRawPointer?)
func removeObserver (NSObject, forKeyPath : String)
var description: String
func description(withLocale : Any?) -> String
func makeIterator () -> NSFastEnumerationIterator