Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 4 #359

Closed
rayhk6 opened this issue Sep 24, 2017 · 29 comments
Closed

Swift 4 #359

rayhk6 opened this issue Sep 24, 2017 · 29 comments

Comments

@rayhk6
Copy link

rayhk6 commented Sep 24, 2017

I used #351 link for my project. However, the duration function is no longer work. Please kindly help to fix. Thanks.

@fullmetalsheep
Copy link
Contributor

for now, click on the error. It should show automatically what the new code should look like. Then run the app again.

@rayhk6
Copy link
Author

rayhk6 commented Sep 26, 2017

It doesn't support the duration now?
alertView.showError("Title", subTitle:"abc", duration: 3)
It shows
Incorrect argument label in call (have ':subTitle:duration:', expected ':subTitle:closeButtonTitle:') Replace 'duration' with 'closeButtonTitle'

@fullmetalsheep
Copy link
Contributor

hmm, i'm not with my macbook right now. I'll look into it this weekend. Hopefully someone else can do it sooner.

@justdan0227
Copy link

Please update. Have always loved this library. Looking forward to Swift4 update

@ahmedsafadii
Copy link
Contributor

I update the library for swift 4

    pod 'SCLAlertView', :git => 'https://github.com/ahmedsafadii/SCLAlertView-Swift.git'

@rayhk6
Copy link
Author

rayhk6 commented Sep 27, 2017

Thanks @ahmedsafadii , but not fixing the duration issue.

@ahmedsafadii
Copy link
Contributor

@rayhk6 what issue , I used it and it's amazing oO

@ahmedsafadii
Copy link
Contributor

try replace both file with this :)

@ahmedsafadii
Copy link
Contributor

Archive.zip

@Piyush08
Copy link

@ahmedsafadii I still facing same issue for duration!

@ahmedsafadii
Copy link
Contributor

@Piyush08 can you share your code or screen the problem ?

@rayhk6
Copy link
Author

rayhk6 commented Sep 29, 2017

@Piyush08 Please replace duration with timeout. It works for me.
Ref: https://github.com/vikmeup/SCLAlertView-Swift/blob/master/Example/SCLAlertViewExample/ViewController.swift

@rayhk6 rayhk6 closed this as completed Sep 29, 2017
@ahmedsafadii
Copy link
Contributor

        let alert = SCLAlertView(appearance: appearance)
        let showTimeout = SCLButton.ShowTimeoutConfiguration(prefix: "(", suffix: " " + "second".localize() + ")")
        _ = alert.addButton("cancel_order".localize(), backgroundColor: UIColor(hex:"FFBA00"), textColor: UIColor.white, showTimeout: showTimeout) {

}

 let timeoutValue: TimeInterval = 5.0
        let timeoutAction: SCLAlertView.SCLTimeoutConfiguration.ActionType = {
            
            
        }
        
        alert.showWait("", subTitle: "order_message_to_drivers".localize(), timeout: SCLAlertView.SCLTimeoutConfiguration(timeoutValue: timeoutValue, timeoutAction: timeoutAction), colorStyle: 0xFFBA00, colorTextButton: 0xFFFFFF)

@Piyush08
Copy link

Hello @ahmedsafadii ,

Can't I use same format like as duration now? Just specify second & after that dismiss automatically.

Rather than this adding button scenario.

Thank you,

@rayhk6
Copy link
Author

rayhk6 commented Sep 29, 2017

@Piyush08

alertView.showInfo("", subTitle: "ABC", timeout: SCLAlertView.SCLTimeoutConfiguration(timeoutValue: 3, timeoutAction: SCLAlertView.SCLTimeoutConfiguration.ActionType = {
    print("")
}))

@Piyush08
Copy link

@ahmedsafadii

still getting error as "Cannot assign to immutable expression of type 'SCLAlertView.SCLTimeoutConfiguration.ActionType.Type' (aka '(() -> ()).Type')"

@ahmedsafadii
Copy link
Contributor

ahmedsafadii commented Sep 29, 2017

@Piyush08
Copy link

@ahmedsafadii I already replace this as you mentioned above

@ahmedsafadii
Copy link
Contributor

@Piyush08 can you share the alert code here ^^"

@Piyush08
Copy link

screen shot 2017-09-30 at 12 53 36 am

@ahmedsafadii
Copy link
Contributor

@Piyush08 the code please :3

@Piyush08
Copy link

@ahmedsafadii I already share as above image

@ahmedsafadii
Copy link
Contributor

@Piyush08 ok give me a sec

@ahmedsafadii
Copy link
Contributor

ahmedsafadii commented Sep 29, 2017

try this

@Piyush08

let timeoutAction: SCLAlertView.SCLTimeoutConfiguration.ActionType = {
        // action here
}
        
SCLAlertView().showError("test", subTitle: "test",timeout:SCLAlertView.SCLTimeoutConfiguration(timeoutValue: 3.0, timeoutAction:timeoutAction))

@Piyush08
Copy link

@ahmedsafadii

It works!

Thanks for your quick & great help!

Happy coding!

@ahmedsafadii
Copy link
Contributor

@Piyush08 np ;)

@justdan0227
Copy link

justdan0227 commented Oct 3, 2017

So whats the workflow for adding this to a new Swift4 project now?

@vikmeup
Copy link
Owner

vikmeup commented Oct 3, 2017

@justdan0227 create PR with changes to support Swift4, I would be happy to merge it

@ahmedsafadii
Copy link
Contributor

@vikmeup #361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants