-
Notifications
You must be signed in to change notification settings - Fork 0
/
CTVFLOpcode.swift
63 lines (57 loc) · 1.74 KB
/
CTVFLOpcode.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// CTVFLOpcode.swift
// CTVFL
//
// Created on 2019/3/28.
//
public enum CTVFLOpcode {
case push
case pop
case moveFirstItem(Item)
case moveFirstItemFromRetVal(ItemIndex)
case moveFirstAttribute(CTVFLLayoutAttribute)
case moveFirstAttributeFromRetVal(AttributeIndex)
case moveSecondItem(Item)
case moveSecondItemFromRetVal(ItemIndex)
case moveSecondAttribute(CTVFLLayoutAttribute)
case moveSecondAttributeFromRetVal(AttributeIndex)
case moveRelation(CTVFLLayoutRelation)
case moveReleationFromRetVal
case moveConstant(CGFloat)
case moveConstantFromRetVal
case moveUsesSystemSpace(Bool)
case movePriority(CTVFLPriority)
case movePriorityFromRetVal
case moveLhsItem(Item)
case moveLhsItemFromRetValLhsItem
case moveRhsItem(Item)
case moveRhsItemFromRetValRhsItem
case makeConstraint
public enum AttributeIndex {
case first
case second
}
public enum ItemIndex {
case lhs
case rhs
case first
case second
}
public enum Item {
case container
case confinable(CTVFLConfinable)
case layoutable(CTVFLLayoutable)
internal func _getAnchorSelector(with another: Item?) -> CTVFLLayoutAnchorSelectable? {
switch (self, another) {
case let (.layoutable(layoutable), _):
return layoutable._asAnchorSelector
case let (.confinable(confinable), _):
return confinable._asAnchorSelector
case let (.container, .some(.layoutable(layoutable))):
return (layoutable._asAnchorSelector as? CTVFLView)?.superview
default:
return nil
}
}
}
}