Avatar
norio_nomura 4/26/2018 5:49 AM
なるほど、これで動く。 @swift-4.2.4 struct A { var strings: AnySequence<String> { return AnySequence { () -> AnyIterator<String> in var buffer = ArraySlice(staticStrings ?? []) return AnyIterator { if let first = buffer.popFirst() { return first } return nil } } } } let staticStrings: [String]? = ["1", "2"] (edited)