Code Monkey home page Code Monkey logo

neon's People

Contributors

basthomas avatar bhendersonizeni avatar esqarrouth avatar icykira avatar idurian avatar lexrus avatar mamaral avatar moonko avatar nhojb avatar pedrovereza avatar tim12s 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  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

neon's Issues

wrong height while overriding updateConstraints using AutoHeight

I am overriding updateConstraints in the init, and first I have a wrong height (too much) for the labels I have aligned, and only after three times (idk why it calls it three times) accessing a function updateConstraints it gives right height. It is better to understand showing the code.

override func updateConstraints() {
        locationLabel.anchorToEdge(.top, padding: 0, width: self.frame.width, height: AutoHeight)
        seasonLabel.align(.underCentered, relativeTo: locationLabel, padding: 0, width: self.frame.width, height: AutoHeight)
        seasonLabel.alignAndFillWidth(align: .underCentered, relativeTo: locationLabel, padding: 0, height: AutoHeight)
        quantityLabel.alignAndFillWidth(align: .underCentered, relativeTo: seasonLabel, padding: 0, height: AutoHeight)
        durationLabel.alignAndFillWidth(align: .underCentered, relativeTo: quantityLabel, padding: 0, height: AutoHeight)
        requirementsLabel.align(.underMatchingLeft, relativeTo: durationLabel, padding: 0, width: self.frame.width*0.9, height: self.labelHeight)
        height = locationLabel.frame.height+seasonLabel.frame.height+quantityLabel.frame.height+durationLabel.frame.height+self.labelHeight
        print (height)
    }

In the console I have:

1306.0
1348.0
479.0

And here first two heights are too big (wrong), and the last one is right. How can I get only the last one?

Installing with Carthage - build failed

When I attempt to install this framework with Carthage, the build fails with the following output:

.../Carthage/Checkouts/Neon/Source/Neon.swift:30:9: error: value of type 'View'
(aka 'NSView') has no member 'sizeToFit'                                                                             
A shell task failed with exit code 65:                                                                               
** BUILD FAILED **

has anyone found a workaround for this (besides installing it as a module)?

Paddings -> offsets

Wouldnt it be fitting to refactor xPad: CGFloat, yPad: CGFloat type arguments to something nice like offset: CGSize and/or offset: UIEdgeInsets. Seems a bit nicer to me, or at least provide it as overloads to current implementation :)

Support for safeArea Layout with iOS 11/iPhone X ?

With the release of iPhone X, apps that use Neon are working without runtime issues, but since the iPhone X has some interesting physical attribute it will be great if Neon could add support for the safeArea layout that is now available. Neon should support the safe area at the top for avoiding any issue with the "notch" of the iPhone X, and since the bottom area with the iPhone X has the visible UI element for dragging up it will be good to have some updated API that could account for it.

AutoHeight doesn't work if UILabel text is set after the constraints are made.

For example, this will only display a label with a height large enough for "Hello World".

        let label : UILabel = UILabel()
        self.view.addSubview(label)
        
        label.textColor = .black
        label.numberOfLines = 0
        label.lineBreakMode = .byWordWrapping
        
        label.text = "Hello world"
        label.anchorAndFillEdge(.bottom, xPad: 24, yPad: 24, otherSize: AutoHeight)
        label.text = "asdfn aksdjhf akjsdhf kajhsd fkjhasd fkjhads kjfha sdkjhf akjsdhf akjshdf kajhsdf kjhasd fkh ckhsd chjsdfkv hjsdfv ksjdhfv ksjhdfv kjshdf vkjshdf vkjhsdf end"

Question: How is animation with neon?

I just saw the library, didn't dig into it much, but hopefully considering to use it. Just one concern, how is the basic animations with neon, what are the animation properties? Like with autolayout you animate the constraints constants which is a pain in the ass rather than normal uiview animations.

If the animation is breeze I'm all on with this layout system :)
👍

Support right-to-left languages

I think a little bit about that.
As a basis idea we can take AutoLayout approach:
.leading means .left on left-to-right languages and means .right on right-to-left languages;
.trailing means .right on left-to-right languages and means .left on right-to-left languages.

We can implement this by simple adding factory functions to our enums(Edge, Corner, Align), for example for Edge:

public enum Edge {
    case top
    case left
    case bottom
    case right

    static func leading() -> Edge {
        return isRightToLeft() ? .right : .left
    }

    static func trailing() -> Edge {
        return isRightToLeft() ? .left : .right
    }
}

Then if client code wants to respect language direction, it should use .leading() and .trailing() functions instead .left and .right:

func isRightToLeft() -> Bool {
//    return UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft
    return true
}

func bar(edge: Edge) {
    switch edge {
    case .left:
        print("left")
    case .right:
        print("right")
    case .top:
        print("top")
    case .bottom:
        print("bottom")
    }
}

bar(edge: .leading()) // prints 'right'

@mamaral what you think about this approach? Any suggestions?

Cannot do layout with transform

If this property is not the identity transform, the value of the frame property is undefined and therefore should be ignored.

from apple documentation

And if you use any transform on your own view, you cannot do layout with Neon methods

I suggest set transform to "Indentity" before layout and return after in all Neon methods

keep aspect-ratio of view

I might just not see it, but is there any way to implement a dynamically sized view that keeps its aspect-ratio?

Best Regards

iOS 11

I really like this library and its simplicity in layouts. Is there any plans to update?

StackFillEdge?

Perhaps i am missing this, or perhaps my suggested name is not quite right but my basic use case causes me to introduce container views to achieve my layout. It is similar to building a table row by row: the first view must fill top width, then the next one must fill the next top width below it and so on. Grouping top left than calculating width could work but the adding of the elements can be staggering in time.

Perhaps this is already easy and I am just missing how? thx..

Awesome repo btw!!

enums to OptionSets

Right now:

avatarImageView.anchorInCorner(.BottomLeft, xPad: 15, yPad: 15, width: avatarSize, height: avatarSize)

could be:

avatarImageView.anchorInCorner([.Bottom, .Left], xPad: 15, yPad: 15, width: avatarSize, height: avatarSize)

Example of bitmask/option sets/flags in Swift 2.0:

struct MyOptions : OptionSetType {
    let rawValue: Int

    static let None         = MyOptions(rawValue: 0)
    static let FirstOption  = MyOptions(rawValue: 1 << 0)
    static let SecondOption = MyOptions(rawValue: 1 << 1)
    static let ThirdOption  = MyOptions(rawValue: 1 << 2)
}

let singleOption = MyOptions.FirstOption
let multipleOptions: MyOptions = [.FirstOption, .SecondOption]
if multipleOptions.contains(.SecondOption) {
    print("multipleOptions has SecondOption")
}
let allOptions = MyOptions(rawValue: 7)
if allOptions.contains(.ThirdOption) {
    print("allOptions has ThirdOption")
}

Bump podspec to '0.3.4.4'

The latest release is '0.3.4.4', however, in podspec the version is '0.3.4.3', which is incorrect.
Please fix it.

Using Neon in a custom view xib?

I saw one other issue like that (unfortunately with no follow-up by the OP). I am hoping to create a custom nib-based view to drop into a main view, and each instance will manage its own layout via neon (liking the repo!). But, there is absolutely no neon-action within the instantiation. I have the most basic of view, and simply firing it up within the main VC, and dropped a sample view that is instructed to fill its container. I set the colors to show me it works. It does not. Wondering if you have tried something similar?

Button click action is not working

Hi,
In TwitterProfileExampleViewController, i add a click event to cameraButton which is an UIButton, but the click action is not working. Can you help me please. thanks

` cameraButton.setImage(UIImage(named: "camera"), for: .normal)
cameraButton.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)

func buttonAction(sender: UIButton!) {
    var btnsendtag: UIButton = sender
    if btnsendtag.tag == 1 {
        //do anything here
    }
}

`

How to layout a table with equal cell height and width?

Give a resizable UIView, what is the proper way to layout a 3 x 4 table with equal width and height for each cell?

For example, when the view is 120 x 120, each cell is 40 x 30. When the view is resize to 240 x 360, each cell changes to 80 x 90.

UILabel width

Hi,

Great work on making a super flexible and simple layout framework.

Any chance you can have tried to have UIButton and UILabel to automatically calculate their widths as per below where the width of a button/label can be calculated from its contents?

button1.anchorInCornerAndUseWidth(.BottomLeft, xPad: 20, yPad: 20, height: 30)
label2.alignAndUseWidth(align: .ToTheRightMatchingTop, relativeTo: button1, padding: 20, height: 30)
button3.alignAndFillWidth(align: .ToTheRightMatchingTop, relativeTo: label2, padding: 20, height: 30)

Thanks for the elegant work,
-Tim

Use Legacy Swift Language Version

I getting issue like this using carthage

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

After aligning the UIscrollview, the subview cant be shown and not scrollable

Dear Sir,

Thanks for making this features. They are awesome! Hope more and more people use yours masterpiece. It's very useful. 👍 👍 👍 👍

However, for the UIscrollview, the subview cant be shown and not scrollable. Do you have any procedures to include the subview of UIscrollview or how to make the scrollview to be scrollable?

Thanks a lot! Looking forward to hearing from yours :)
Best Regards,
JC

How to autoheight UITableViewCell?

When i use Neon,I can't use this gramera to autoHeight UITableViewCell
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = 300

Could you fix the problem?
Thank you.

Allow setting xPad, yPad individually for groupAgainstEdge

Hello,

I am currently using the groupAgainstEdge method to group 3 dots together, aligned at the bottom edge, like so:

view.groupAgainstEdge(group: .Horizontal, views: [pageIndexCircles[0], pageIndexCircles[1], pageIndexCircles[2]], againstEdge: .Bottom, padding: 10, width: 10, height: 10)

The limitation is that the padding determines both the vertical padding from the bottom /and/ the horizontal padding of the dots together. E.g., if I increase the padding value, the dots move further away from the bottom edge and further away from each other. I assume this is a simple oversight in an otherwise amazing framework. Being able to specify the horizontal/vertical padding separately for groupAgainstEdge (where, depending on if the group is .Horizontal or .Vertical, the xPad will control the spacing between the elements of the group and yPad the distance from the edge, and vice-versa).

Thanks very much.

Update to Swift 3

Already noticed a lot of updates are required. I may try to update some of the stuff, but I'm really busy at the moment. What are the plans to update Neon to Swift v3?

Views array fatal error

        var views:[UIView] = []
        let view1 = UIView()
        view1.backgroundColor = UIColor.redColor()
        let view2 = UIView()
        view2.backgroundColor = UIColor.greenColor()

        view.addSubview(view1)
        view.addSubview(view2)

        views.append(view1)
        views.append(view2)

        view.groupAndFill(group: .Horizontal, views: views, padding: 10)

fatal error: array cannot be bridged from Objective-C

Autolayout question

Hey there,

I was wondering what this is using under the hood? Are we able to "mix and match" auto layout constraints via Storyboard and Neon for some other views?

Thanks and great job with this!

Prefix the methods

Hi,
I think it would be a good idea to prefix every methods you have added to UIView.
It would be simpler for others people to find / discover your methods.

AsyncDisplayKit

I saw in some issue in Facebooks ASDK that someone wanted to use Neon with ASDK. They told him it would be difficult to implement but I think its as easy as

extension ASDisplayNode : Frameable, Anchorable, Alignable, Groupable {
    public var superFrame: CGRect {
        guard let supernode = supernode else {
            return CGRectZero
        }

        return supernode.frame
    }
}

Isn't it?

Propose grouping without explicit size

Hello,
I would like to propose idea of grouping without calculating the size of the group explicitly. In that case, Neon should call sizeToFit on each of the subviews and calculate the total size.
In addition to

anchorViewA.groupInCenter(group: .Horizontal, views: [view1, view2, view3], padding: padding, width: size, height: size)

there would be this option

anchorViewA.groupInCenter(group: .Horizontal, views: [view1, view2, view3], padding: padding)

How do you feel about it?

The reason behind this feature is to group multiple items that are of different size.

set the xPad and yPad to zero as default value

I have an idea:
set the xPad and yPad to zero as default value.so that we can have an api that needn't pass the xPad and yPad if xPad is 0 and yPad is 0 .
because almost every API in Neon contains parameters of xPad and yPad,and almost every time I pass zero to them.If the default value is Zero,I will needn't pass zero any more.
My code will be nicer~

error while carthage update

I add the neon to my Cartfile,but while Im run carthage update commond,terminal show an error:

  *** Fetching Neon
  *** Checking out Neon at "v0.0.2"
  *** xcodebuild output can be found in /var/folders/5y/x8t9wb3d1t33b77ckz509p_w0000gn/T/carthage-xcodebuild.JEhAhQ.log
 A shell task failed with exit code 66:
 xcodebuild: error: Scheme NeonMacDemo is not currently configured for the build action.

20 lines of code

In the meantime, here's an intentionally convoluted example to show how easy it is to build very complex and dynamic layouts with Neon. The following layout was created with only 20 lines of code.

Can we see this code? Thanks.

Support Swift Package Manager

Given GitHub and Xcode now have integrations with the SPM, it would be good to support it, so the library is easy to integrate.

Carthage Build App Store Submission Bug

When I use Neon via Carthage in my app and upload it to iTunes Connect, I get the following email from Apple:

Dear developer,

We have discovered one or more issues with your recent delivery for "Wispeo". To process your delivery, the following issues must be corrected:

Invalid Bundle - Do not submit apps with GCC-style coverage instrumentation enabled. Specifically, the following Xcode build settings should be disabled: Instrument Program Flow Generate Test Coverage Files

Once these issues have been corrected, you can then redeliver the corrected binary.

Regards,

The App Store team

The email should have a comma between "Instrument Program Flow" and "Generate Test Coverage Files."

Can we just disable these build options? I'm not sure why they'd be needed in the first place.

Dynamic UIlabel

It's not a issue just a suggestion. at the moment I have UILabels that can have 1 to 2 lines depending and text size.

at the moment I do this like this but I'm sure there is a better way

let nameLabelHeight = nameLabel.text?.heightWithConstrainedWidth(self.width - 24 - profilePictureImageView.width, font: nameLabel.font)
    if let n = nameLabelHeight where n > 60 {
        nameLabel.alignAndFillWidth(align: .ToTheRightMatchingTop, relativeTo: profilePictureImageView, padding: 8, height: 60)
    } else if let n = nameLabelHeight {
        nameLabel.alignAndFillWidth(align: .ToTheRightMatchingTop, relativeTo: profilePictureImageView, padding: 8, height: n)
    }

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.