Snapkit: Error: 'NSLayoutAttribute' has been renamed to 'NSLayoutConstraint.Attribute'

Created on 2 Jul 2018  路  2Comments  路  Source: SnapKit/SnapKit

Info | Value |
-------------------------|-------------------------------------|
Platform | iOS
Platform Version | iOS 12 Developer Beta
SnapKit Version | 4.0.0
Integration Method | cocoapods

Issue Description

When using SnapKit 4.0.0 with Xcode 10 Beta and swift 4, the project can not be compiled successfully. The error message is 'NSLayoutAttribute' has been renamed to 'NSLayoutConstraint.Attribute'. I have tried to clean build folder, but still error.

Most helpful comment

Until this is solved with an official iOS 12 / Swift 4.2 release, you can add something like this to your Podfile to ensure SnapKit continues to use Swift 4.1:

swift_4_1_pod_targets = ['SnapKit']

post_install do | installer |
    installer.pods_project.targets.each do |target|
        if swift_4_1_pod_targets.include?(target.name)
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '4.1'
            end
        end
    end
end

All 2 comments

The error is caused by API changes in iOS 12. The commit #516 may has solved the problem.
Any idea about a new release for iOS 12 ? The recent version 4.0 is released on Sep 2017.

Until this is solved with an official iOS 12 / Swift 4.2 release, you can add something like this to your Podfile to ensure SnapKit continues to use Swift 4.1:

swift_4_1_pod_targets = ['SnapKit']

post_install do | installer |
    installer.pods_project.targets.each do |target|
        if swift_4_1_pod_targets.include?(target.name)
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '4.1'
            end
        end
    end
end

Was this page helpful?
0 / 5 - 0 ratings

Related issues

romk1n picture romk1n  路  3Comments

netgfx picture netgfx  路  3Comments

danieleggert picture danieleggert  路  3Comments

NicholasTD07 picture NicholasTD07  路  8Comments

cooler333 picture cooler333  路  5Comments