Thanks.
Zhao Xin
On Tue, Jul 11, 2017 at 2:29 AM, Jordan Rose wrote:
>
>
> On Jul 7, 2017, at 22:50, Marco S Hyman via swift-users <
> swift-users@swift.org> wrote:
>
>
> On Jul 7, 2017, at 9:48 PM, Zhao Xin wrote:
>
> Thank you very much Marco. But
> On Jul 7, 2017, at 22:50, Marco S Hyman via swift-users
> wrote:
>
>
>> On Jul 7, 2017, at 9:48 PM, Zhao Xin wrote:
>>
>> Thank you very much Marco. But What is “outside of an initializer” really
>> bothers me. **Both** `func
> On Jul 7, 2017, at 9:48 PM, Zhao Xin wrote:
>
> Thank you very much Marco. But What is “outside of an initializer” really
> bothers me. **Both** `func bar(keysAndValues:Dictionary)`
> works now. **Are they really outside ?**
Uhhh, that is certainly not
Thank you very much Marco. But What is “outside of an initializer” really
bothers me. **Both** `func bar(keysAndValues:Dictionary)`
works now. **Are they really outside ?**
struct Foo {
var keys = ["z","y","x"]
{
didSet {
keys.sort()
}
> init(keysAndValues:Dictionary) {
> self.keys.append(contentsOf: keysAndValues.keys)
> }
>
> Above code doesn't call `didSet` in playground. My .swift file is similar and
> didn't call `didSet` either. However, if without a struct, `didSet` is called.
“If
import Cocoa
struct Foo {
var keys = ["z","y","x"]
{
didSet {
keys.sort()
}
}
init(keysAndValues:Dictionary) {
self.keys.append(contentsOf: keysAndValues.keys)
}
}
let keysAndValues:Dictionary =
It definitely should. Can you show the code where it wasn’t being called?
Thanks!
Jordan
> On Jul 7, 2017, at 00:31, Zhao Xin via swift-users
> wrote:
>
> Should Array's `append(_)` functions cause the array's `didSet`?
> In my own test, it did call `didSet` in
Should Array's `append(_)` functions cause the array's `didSet`?
In my own test, it did call `didSet` in Playground. But in .swift files, it
didn't call.
Is this a known bug or something? Which is correct?
Xcode Version 9.0 beta 2 (9M137d)
swift --version
Apple Swift version 4.0