I am forced to use an NSMutableArray and populate it using a loop:
- (instancetype)initWith:(NSUInteger)capacity rolling:(BOOL)rolling {
_list = [NSMutableArray arrayWithCapacity:capacity];
// Populate the array with all NSNull values.
for (NSUInteger i = 0; i < capacity; i++)
[_list addObject:NSNull.null];
}
Yes, this is just what I want. I wanted the experts to confirm that private and fileprivate at file level work the same way.
BTW, I am quite familiar with private modifier inside enum/class/struct definitions.
The info in the language reference does not explain what's the difference.
It seems when used in file level private is same as fileprivate:
class SandBoxVC: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
print(aaaa, bbbb) // no compiler error here
}
}
fileprivate let aaaa = 1234
private let bbbb = "bbbb"
I almost believe this is an oversight bug in Swift compiler - private should not be used in file level.
I am on Appkit, it seems NSScrollView does not have onChange event, and I cannot find any properties/notifications that can tell me the current scroll position. That's odd.
Ah, English is not my native language. And any legal documentation is cryptic to me, I can never understand them, even if they are written in my native language.
I am forced to use an NSMutableArray and populate it using a loop:
- (instancetype)initWith:(NSUInteger)capacity rolling:(BOOL)rolling {
_list = [NSMutableArray arrayWithCapacity:capacity];
// Populate the array with all NSNull values.
for (NSUInteger i = 0; i < capacity; i++)
[_list addObject:NSNull.null];
}
Yes, this is just what I want. I wanted the experts to confirm that private and fileprivate at file level work the same way.
BTW, I am quite familiar with private modifier inside enum/class/struct definitions.
The info in the language reference does not explain what's the difference.
It seems when used in file level private is same as fileprivate:
class SandBoxVC: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
print(aaaa, bbbb) // no compiler error here
}
}
fileprivate let aaaa = 1234
private let bbbb = "bbbb"
I almost believe this is an oversight bug in Swift compiler - private should not be used in file level.
I am on Appkit, it seems NSScrollView does not have onChange event, and I cannot find any properties/notifications that can tell me the current scroll position. That's odd.
Ah, English is not my native language. And any legal documentation is cryptic to me, I can never understand them, even if they are written in my native language.