CosmicMind/Material

Any plan to support Xcode 11?

himaratsu opened this issue ยท 11 comments

Hi!

in Xcode 11, we can't build app using Material.
Error message is here:

*** Assertion failure in -[_UINavigationBarContentView setLayoutMargins:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3899.8.4/_UINavigationBarContentView.m:703
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Client error attempting to change layout margins of a private view'

Do you have any plan to support this? Thanks.

@himaratsu Yes, there are always plans to support the latest from Apple. Because it is beta, we usually wait until it is closer to release, or released. That said, we will most likely make a branch for it and help users to start exploring iOS 11 with Material. I will leave this issue up, and tackle that for you later this week. Thank you for sharing your question.

I've spent much time on the same issue and have come up with a workaround that works for me and I think it will help you as well.

On iOS 13, changing layout margins of a private view is not allowed. So, expanding the frame to eliminate the layout margins can be an alternative solution.

if (@available(iOS 13.0, *)) {
    UIEdgeInsets margins = view.layoutMargins;
    CGRect frame = view.frame;
    frame.origin.x = -margins.left;
    frame.origin.y = -margins.top;
    frame.size.width += (margins.left + margins.right);
    frame.size.height += (margins.top + margins.bottom);
    view.frame = frame;
}
else {
    view.layoutMargins = UIEdgeInsetsZero;
}

@nguyenbao95 @himaratsu Thank you for the support!

We are getting ready to roll out updates for iOS 13 and supper Xcode 11 in the next few weeks.

@adamdahan saw that you moved it to done. I'm curious what was the fix for iOS 13.
Facing the same issue.

@mrtsamma You are correct. :) I realize now this ticket was visibility for others on the iOS 13 topic. Reopening issue until we release the IOS 13 patch.

Ok, @nguyenbao95 answare suits for me with a small change(thanks):

for view in subviews {
    if #available(iOS 13.0, *) {
        let margins = view.layoutMargins
        var frame = view.frame
        frame.origin.x = -margins.left
        frame.size.width += (margins.left + margins.right)
        view.frame = frame
    } else {
        view.layoutMargins = .zero
    }
}

I don't need and can't to change height nor y pos.

please merge this fix, I can't build my project anymore @DanielDahan

@22Round Try Material 3.1.8. Thank you!

@mrtsamma where have you placed this your code? I have upgraded to xcode 11.3 i'm getting same crash. how i can i recover from it.

@adamdahan have your lib updated for 11.3 and iOS 13 version, if so please let me know the link or pods i'm facing an issue