Material 2 & Swift 3 Release

Created on 16 Sep 2016  ·  11Comments  ·  Source: CosmicMind/Material

The latest date that Material 2 with Swift 3 support will be released is on September 30th 2016.

We are making final decisions on the API going forward, and writing documentation to support the Material framework.

We appreciate your support and look forward to providing an excellent product that we are proud to share with our growing community.

enhancement

Most helpful comment

Till then u can check the development branch it contains support for swift 3

pod 'Material', :git => 'https://github.com/CosmicMind/Material.git', :branch => 'development'

All 11 comments

I am waiting for swift 3 as it is not working with swift 3.

Till then u can check the development branch it contains support for swift 3

pod 'Material', :git => 'https://github.com/CosmicMind/Material.git', :branch => 'development'

toolbar.titleLabel.textColor = MaterialColor.white error: Use of unresolved identifler 'MaterialColor'

Thank you. but toolbar.leftControls can not work now?

whats the problem?

ListViewController.swift:557:9: Value of type 'Toolbar' has no member
'leftControls'

@tianqiujie it is now leftViews.

In ios 9 my toolbar work nice, but when upgrade to the ios 10. It is cannot work normal. please help me. Thank you very much!

fileprivate func initToolbar() {
        let containerView = UIView()
        mToolbarContainer.addSubview(containerView)

       // MaterialLayout.alignToParent(mToolbarContainer, child: containerView, top: 0, left: 0, right: 0)
        //view.layout(containerView).edges(top: 0, left: 0, right: 0)

        //48
        let toolbar = Toolbar()
        toolbar.height += 4
        print(toolbar.height)

        view.layout(containerView).edges(top: 0, left: 0, bottom: view.frame.size.height - toolbar.height, right: 0)

        containerView.bounds.size.height = toolbar.height
        containerView.addSubview(toolbar)

        // Title label.
        toolbar.title = "My Files".localedStr
        toolbar.titleLabel.textColor = Color.white

        let image: UIImage? = UIImage(named: "arrow_back")//MaterialIcon.cm.menu

        // Menu button.
        let backBtn: IconButton = IconButton()
        backBtn.pulseColor = Color.white
        backBtn.tintColor = Color.white
        backBtn.setImage(image, for: UIControlState())
        backBtn.setImage(image, for: .highlighted)
        backBtn.addTarget(self, action: #selector(onBack), for: UIControlEvents.touchUpInside)

        /*
         To lighten the status bar - add the
         "View controller-based status bar appearance = NO"
         to your info.plist file and set the following property.
         */
        toolbar.backgroundColor = Color.blue.base

        //toolbar.leftControls = [backBtn]
        toolbar.leftViews = [backBtn]
    }

IOS9:
image

IOS10:
image

What are you trying to do with the containerView ? and let's move this to https://gitter.im/CosmicMind/Material

FYI for anyone who runs into Xcode claiming that Material isn't updated to Swift 3 -- you may need to update Cocoapods to 1.1.1 or above. Updating and then running pod install fixed the problem for me.

The errors were:

The target “Material” contains source code developed with an earlier version of Swift.
Choose “Convert” to update the source code in this target to the latest SDKs. You will be given the choice to use Swift 2.3 syntax or update to Swift 3.
This action can be performed later using “Convert to Current Swift Syntax” in the Edit menu.

“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.

Was this page helpful?
0 / 5 - 0 ratings