[ad_1]
If i run the code beneath:
import Basis
import Mix
import UIKit
let textField = UITextField()
let array = ["1", "2", "3", "4", "5", "6", "7"]
let writer = array.writer
//Assertion 1
textField.writer(for: .textual content).sink{ print("Sink for .textual content property on textfield: ($0!)")}
//Assertion 2
let subscriber = writer.compactMap {$0}.assign(to: .textual content, on: textField)
let _ = writer.dropFirst(2).sink{print("Sink for array: ($0)")}
I get the output:
sink for .textual content property on textfield: 1
sink for .textual content property on textfield: 2
sink for .textual content property on textfield: 3
sink for .textual content property on textfield: 4
sink for .textual content property on textfield: 5
sink for .textual content property on textfield: 6
sink for .textual content property on textfield: 7
Sink for array: 3
Sink for array: 4
Sink for array: 5
Sink for array: 6
Sink for array: 7
But when I flip the order of the statements 1 and a pair of, the output turns into a lot totally different:
Sink for .textual content property on textfield: 7
Sink for array: 3
Sink for array: 4
Sink for array: 5
Sink for array: 6
Sink for array: 7
Why is that?
I attempted to look into Mix documentation however could not discover a solution that is sensible.
[ad_2]
