Skip to content

Commit 3022cd3

Browse files
committed
Add Swift refinements for TreeElement
1 parent 805764b commit 3022cd3

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// TreeElement.swift
3+
// OpenGraph
4+
5+
public import OpenGraphCxx
6+
7+
extension TreeElement {
8+
public var value: AnyAttribute? {
9+
let result = __OGTreeElementGetValue(self)
10+
return result == .nil ? nil : result
11+
}
12+
}
13+
14+
extension Nodes: @retroactive IteratorProtocol {
15+
public typealias Element = AnyAttribute
16+
public mutating func next() -> AnyAttribute? {
17+
let result = __OGTreeElementGetNextNode(&self)
18+
return result == .nil ? nil : result
19+
}
20+
}
21+
22+
extension Children: @retroactive IteratorProtocol {
23+
public typealias Element = TreeElement
24+
}
25+
26+
extension Values: @retroactive IteratorProtocol {
27+
public typealias Element = TreeValue
28+
}
29+
30+
extension TreeElement {
31+
public struct LocalChildren {
32+
public var base: Children
33+
}
34+
}

0 commit comments

Comments
 (0)