Code Monkey home page Code Monkey logo

swiftautolayout's Introduction

SwiftAutoLayout

SwiftAutoLayout is a tiny DSL for Autolayout intended to provide a more declarative way to express layout constraints. Here's a quick example:

// this:
let constraint = view1.left == view2.right * 2.0 + 10.0 ~ 750
		
// is equivalent to:
let constraint = NSLayoutConstraint(item: view1, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: view2, attribute: NSLayoutAttribute.Right, multiplier: 2.0, constant: 10.0)
constraint.priority = 750

You may notice that this looks a lot like the linear equation that a constraint represents. From the Apple documentation:

The relationship involves a first attribute, a relationship type, and a modified second value formed by multiplying an attribute by a constant factor and then adding another constant factor to it. In other words, constraints look very much like linear equations of the following form:

attribute1 == multiplier ร— attribute2 + constant

SwiftAutoLayout allows you to more effectively communicate the intent of a constraint by making the syntax more similar to the equation that it represents.

Installing

Use Swift Package Manager or add SwiftAutoLayout.xcodeproj as a subproject and link against either SwiftAutoLayout-iOS.framework or SwiftAutoLayout-Mac.framework depending on the platform.

Attributes

Layout attributes are defined as properties added in extensions of UIView and UILayoutGuide on iOS and NSView and NSLayoutGuide on OS X. For example, UIView.width and UIView.height represent NSLayoutAttribute.Width and NSLayoutAttribute.Height, respectively.

Layout guides (conforming to UILayoutSupport) in UIViewController are also supported using the topLayoutGuideTop, topLayoutGuideBottom, bottomLayoutGuideTop, and bottomLayoutGuideBottom properties.

Relations

Relations are expressed using the overloaded operators == (NSLayoutRelation.Equal), >= (NSLayoutRelation.GreaterThanOrEqual), and <= (NSLayoutRelation.LessThanOrEqual).

Examples

Activating Single Constraint

(view1.left == view2.right * 2.0 + 10.0 ~ 750).active = true

Activating Multiple Constraints

NSLayoutConstraint.activateConstraints([
    view2.centerX == view2.superview!.centerX,
    view2.centerY == view2.superview!.centerY,
    view1.left == view2.right * 2.0 + 10.0 ~ 750,
    view1.top == view2.bottom + 5.0,
    view1.width >= 200,
    view1.height >= 400,
    view1.trailing == layoutGuide.trailing,
    view2.leading == layoutGuide.leading
])

Contact

License

SwiftAutoLayout is licensed under the MIT License.

swiftautolayout's People

Contributors

adlai-holler avatar coryoso avatar indragiek avatar klaaspieter avatar noahd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftautolayout's Issues

Compiler Segfault

I've been attempting to use this project by simply adding SwiftAutoLayout.swift to my project and accessing it directly. The compiler recognizes all the methods, but segfaults on the build. I've experienced this in both Xcode 6 Betas 2 and 3.

To reproduce, I just created a single view application using the default template from Xcode 6 Beta 3, added the SwiftAutoLayout.swift, and added this to the single view controller:

override func viewDidLoad() {
    super.viewDidLoad()

    let box = UIView()
    box.backgroundColor = UIColor.blueColor()

    view.addConstraint(box.al_centerX == view.al_centerX)
    view.addConstraint(box.al_centerY == view.al_centerY)
    view.addConstraint(box.al_width == view.al_width / 2)
    view.addConstraint(box.al_height == view.al_height / 2)
}

The compiler issue also occurs when using intermediate variables like in the readme, a la

let constraint = box.al_centerX == view.al_centerX
view.addConstraint(constraint)

On builds, I get:

CompileSwift normal i386 com.apple.xcode.tools.swift.compiler
    cd /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest
    export PATH="/Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode6-Beta3.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -target i386-apple-ios8.0 -module-name SwiftAutoLayoutTest -O0 -sdk /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -g -module-cache-path /Users/iterrell/Library/Developer/Xcode/DerivedData/ModuleCache -I /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Products/Debug-iphonesimulator -F /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Products/Debug-iphonesimulator -c -j4 /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest/SwiftAutoLayoutTest/ViewController.swift /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest/SwiftAutoLayoutTest/AppDelegate.swift /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest/SwiftAutoLayoutTest/SwiftAutoLayout.swift -output-file-map /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/SwiftAutoLayoutTest-OutputFileMap.json -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/SwiftAutoLayoutTest.swiftmodule -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-generated-files.hmap -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-own-target-headers.hmap -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-all-target-headers.hmap -Xcc -iquote -Xcc /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-project-headers.hmap -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/DerivedSources/i386 -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/DerivedSources -Xcc -DDEBUG=1 -emit-objc-header -emit-objc-header-path /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/SwiftAutoLayoutTest-Swift.h

0  swift                    0x000000010f253de8 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x000000010f2542d4 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff9853d5aa _sigtramp + 26
3  libsystem_platform.dylib 0x00007fac00000003 _sigtramp + 1739336307
4  swift                    0x000000010f552b29 swift::NominalTypeDecl::getMembers(bool) const + 41
5  swift                    0x000000010e62e139 swift::irgen::ClassMetadataLayout<(anonymous namespace)::FindClassMethodIndex>::addClassMembers(swift::ClassDecl*) + 329
6  swift                    0x000000010e627de2 swift::irgen::emitVirtualMethodValue(swift::irgen::IRGenFunction&, llvm::Value*, swift::SILType, swift::SILDeclRef, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ResilienceExpansion) + 434
7  swift                    0x000000010e69448d swift::SILVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::ValueBase*) + 46205
8  swift                    0x000000010e688800 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8896
9  swift                    0x000000010e609d18 swift::irgen::IRGenModule::emitGlobalTopLevel() + 200
10 swift                    0x000000010e675575 performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1829
11 swift                    0x000000010e675f23 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 51
12 swift                    0x000000010e5e7b8e frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4958
13 swift                    0x000000010e5e681d main + 1533
14 libdyld.dylib            0x00007fff901695fd start + 1
15 libdyld.dylib            0x0000000000000038 start + 1877568060
Stack dump:
0.  Program arguments: /Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest/SwiftAutoLayoutTest/ViewController.swift /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest/SwiftAutoLayoutTest/AppDelegate.swift /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest/SwiftAutoLayoutTest/SwiftAutoLayout.swift -enable-objc-attr-requires-objc-module -target i386-apple-ios8.0 -module-name SwiftAutoLayoutTest -sdk /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -I /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Products/Debug-iphonesimulator -F /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Products/Debug-iphonesimulator -g -module-cache-path /Users/iterrell/Library/Developer/Xcode/DerivedData/ModuleCache -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-generated-files.hmap -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-own-target-headers.hmap -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-all-target-headers.hmap -Xcc -iquote -Xcc /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/SwiftAutoLayoutTest-project-headers.hmap -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/DerivedSources/i386 -Xcc -I/Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/ViewController~partial.swiftdoc -O0 -emit-module-path /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/ViewController.dia -emit-dependencies-path /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/ViewController.d -o /Users/iterrell/Library/Developer/Xcode/DerivedData/SwiftAutoLayoutTest-aqahricjhkyokhfrtdfvmjefkvgk/Build/Intermediates/SwiftAutoLayoutTest.build/Debug-iphonesimulator/SwiftAutoLayoutTest.build/Objects-normal/i386/ViewController.o 
1.  While emitting IR SIL function @_TFC19SwiftAutoLayoutTest14ViewController11viewDidLoadfS0_FT_T_ for 'viewDidLoad' at /Volumes/WorkHD/Users/iterrell/src/play/SwiftAutoLayoutTest/SwiftAutoLayoutTest/ViewController.swift:13:14
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Command /Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254

constant on LHS is ignored

let a = scrollView.right == view.right - 100
let b = scrollView.right + 100 == view.right

would appear to be equivalent, no compile or runtime error occurs, but in the second form, the constant is ignored:

a: <NSLayoutConstraint:0x7fcd02dee830 ETVTileHostingScrollView:0x7fcd0221b000.right == UIView:0x7fcd0141d840.right - 100>
b: <NSLayoutConstraint:0x7fcd02ce4be0 ETVTileHostingScrollView:0x7fcd0221b000.right == UIView:0x7fcd0141d840.right>

UITextView error

After update the XCode to the latest version which is 7.3.1 (7D1014), the UITextView is broken because Apple introduce new properties on it.

So if I do myTextView.top I get always error.

Big negative impact on compilation time

After running a profiling script to check the compilation times of the project (because it began to be really slow) I noticed that the methods where I set up the constraints with this library are the ones that take the longest to compile and it's making the project to take between 4 - 5 min to run. The project is really small so it shouldn't be the case.

This is the method that takes the longest to compile. 56690.86ms

fileprivate func setupConstraints() {
        playerComponentView.translatesAutoresizingMaskIntoConstraints = false
        headerComponentView.translatesAutoresizingMaskIntoConstraints = false
        tabsComponentView.translatesAutoresizingMaskIntoConstraints = false
        componentsScrollView.translatesAutoresizingMaskIntoConstraints = false
        topHeaderView.translatesAutoresizingMaskIntoConstraints = false
        closeButton.translatesAutoresizingMaskIntoConstraints = false
        chromecastButton.translatesAutoresizingMaskIntoConstraints = false
        topTitleLabel.translatesAutoresizingMaskIntoConstraints = false

        if UIDevice.current.userInterfaceIdiom == .pad {
            addConstraints([componentsScrollView.width == width * 0.7,
                            componentsScrollView.top == top,
                            componentsScrollView.bottom == bottom,
                            componentsScrollView.centerX == centerX])
        } else {
            addConstraints([componentsScrollView.leading == leading,
                            componentsScrollView.top == top,
                            componentsScrollView.bottom == bottom,
                            componentsScrollView.trailing == trailing])
        }

        let playerHeight = (((UIScreen.main.bounds.height * 0.7) * 9) / 16)
        addConstraints([playerComponentView.leading == componentsScrollView.leading,
                        playerComponentView.trailing == componentsScrollView.trailing,
                        playerComponentView.top == componentsScrollView.top,
                        playerComponentView.height == playerHeight,
                        playerComponentView.width == componentsScrollView.width])

        addConstraints([headerComponentView.top == playerComponentView.bottom,
                        headerComponentView.leading == componentsScrollView.leading,
                        headerComponentView.trailing == componentsScrollView.trailing,
                        headerComponentView.width == componentsScrollView.width])

        addConstraints([tabsComponentView.leading == componentsScrollView.leading,
                        tabsComponentView.trailing == componentsScrollView.trailing,
                        tabsComponentView.top == headerComponentView.bottom,
                        tabsComponentView.bottom == componentsScrollView.bottom,
                        tabsComponentView.width == componentsScrollView.width])

        topHeaderBottomConstraint = (topHeaderView.bottom == top)

        addConstraints([topHeaderBottomConstraint,
                        topHeaderView.leading == componentsScrollView.leading,
                        topHeaderView.trailing == componentsScrollView.trailing])

        let buttonsTopMargin = (UIApplication.shared.statusBarFrame.height + 8)

        addConstraints([closeButton.trailing == topHeaderView.trailing - 8,
                        closeButton.top == top + buttonsTopMargin,
                        closeButton.width == 48,
                        closeButton.height == 48])

        addConstraints([chromecastButton.trailing == closeButton.leading - 8,
                        chromecastButton.top == closeButton.top,
                        chromecastButton.width == 48,
                        chromecastButton.height == 48])

        addConstraints([topTitleLabel.leading == topHeaderView.leading + DetailsViewDesignGuidelines.contentMargin,
                        topTitleLabel.trailing == chromecastButton.leading - 8,
                        topTitleLabel.top == topHeaderView.top + (UIApplication.shared.statusBarFrame.height + 20),
                        topTitleLabel.bottom == topHeaderView.bottom - 16])
}

By changing the constraints configuration to use NSLayoutConstraint directly it goes down to 10.56ms As you can see is quite difference.

Any ideas on what could be the problem or how to fix this? I would really like to continue using this library because it makes so much easier and faster the constraints setup, but the impact it has on the build time is just too big and it will only get worse as the project gets bigger.

Update / Remake Constraints

First off: awesome idea to use operator overloading for defining layout constraints.
There's one catch though - other autolayout frameworks provide methods to update / remove / remake layout constraints.
Like Masonry: https://github.com/Masonry/Masonry/blob/master/Masonry/View%2BMASAdditions.h#L68

How could we represent this with overloaded operators?
I guess removing constraints better would be an own method call. It could also be called before making new constraints to provide the same functionality as remake. That leaves update. Should update be the default behavior?

How to implement a list of UIViews

Hey there, I'm curious to know if SwiftAutoLayout will accomplish my needs. I'd like to have a list of stacked UIView's that fill the width of the screen, each having a dynamic height, and each being seperated by 10 points apart from each other. AKA, something like Facebook's News Feed. Thanks!

Swift 3 compatibility

Hey, I'd love to see this lib available in Swift 3 so I can implement it in my project.

Thanks ๐Ÿ˜„

Installation section organization

Hey, your library is really interesting.

The only problem I found was the README.md, which needs an organization in the Installation Section
I created this iOS Open source Readme Template so you can take a look on how to make it better.
If you want, I can help you to organize the lib.

What are your thoughts? ๐Ÿ˜„

Potential workaround for computed property issue

Hi! I think I've found a potential (temporary) solution for the computed property segfault bug. In fact, I was working on my own unpublished Auto Layout library (whose code is pretty much identical to yours, except for naming) a week ago when I encountered it :)

It turns out the compiler only crashes when you use a computed property that won't seamlessly bridge over to Objective-C, so Int and other primitive types are allowed, but non-@objc Swift objects/structs aren't. All you'd have to do, until Apple fixes the compiler, is replace struct ALOperand with @objc class ALOperand and computed properties should be usable again!

I haven't tested this with your code or made a PR yet because you might want to stick with the 'method style', but it worked for me; if you'd rather use computed properties, this could be a useful workaround.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.