Skip to content

Commit 880fd7e

Browse files
gh-action-runnergh-action-runner
authored andcommitted
Squashed 'apollo-ios/' changes from 0a4b36dc1..9e4bad9cc
9e4bad9cc Add RootSelectionSet convenience initializer from inline fragment (#748) git-subtree-dir: apollo-ios git-subtree-split: 9e4bad9cc2758ffd8027acf07af247c9fe05848c
1 parent caf1906 commit 880fd7e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/ApolloAPI/SelectionSet.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,16 @@ extension SelectionSet where Fragments: FragmentContainer {
128128
public var fragments: Fragments { Fragments(_dataDict: __data) }
129129
}
130130

131+
// MARK: - Root Entity Type Conversion Helpers
132+
131133
extension InlineFragment {
132134
@inlinable public var asRootEntityType: RootEntityType {
133135
RootEntityType.init(_dataDict: __data)
134136
}
135137
}
138+
139+
extension RootSelectionSet {
140+
public init<T: InlineFragment>(_ inlineFragment: T) where T.RootEntityType == Self {
141+
self = inlineFragment.asRootEntityType
142+
}
143+
}

0 commit comments

Comments
 (0)