Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export feature #8

Open
eonist opened this issue Oct 9, 2019 · 2 comments
Open

Add export feature #8

eonist opened this issue Oct 9, 2019 · 2 comments

Comments

@eonist
Copy link
Owner

eonist commented Oct 9, 2019

        (view as? View)?.table.constraints.forEach { constraint in
            Swift.print("constraint:  \(constraint)")
            Swift.print("constraint.constant:  \(constraint.constant)")
            Swift.print("constraint.firstAnchor:  \(constraint.firstAnchor)")
            Swift.print("constraint.isActive:  \(constraint.isActive)")
            Swift.print("constraint.multiplier:  \(constraint.multiplier)")
            Swift.print("constraint.priority:  \(constraint.priority)")
            Swift.print("constraint.secondAnchor:  \(constraint.secondAnchor)")
//            Swift.print("constraint.relation: \(String(describing: constraint.relation))") // three
            Swift.print("constraintRelation(relation: .equal):  \(constraintRelation(relation: .equal))")
        }

 /**
     * Returns the name of of the constraint relation
     * - Note: this is not possible to dervice from the NS enum it self, because its objc enum etc
     */
    func constraintRelation(relation: NSLayoutConstraint.Relation) -> String {
        switch relation {
        case .lessThanOrEqual: return "lessThanOrEqual"
        case .equal: return "equal"
        case .greaterThanOrEqual: return "greaterThanOrEqual"
        default: fatalError("case not covered")
        }
    }
@eonist
Copy link
Owner Author

eonist commented Oct 9, 2019

Note: you can't print the instance variables, but it will give class path.

@eonist
Copy link
Owner Author

eonist commented Oct 9, 2019

should probably export anchor syntax not the older constraint syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant