SCLAlertView-Swift icon indicating copy to clipboard operation
SCLAlertView-Swift copied to clipboard

Cannot invoke value of type 'SCLAlertView.SCLAppearance.Type' with argument list

Open waseefakhtar opened this issue 7 years ago • 3 comments

I just migrated from Swift 2.3 to Swift 3, and this is the error that I encounter:

Cannot invoke value of type 'SCLAlertView.SCLAppearance.Type' with argument list '(kWindowWidth: CGFloat, showCircularIcon: Bool, kCircleHeight: Int, kCircleIconHeight: CGFloat, kTitleTop: CGFloat, kTitleFont: UIFont, kTextHeight: Int, kTextFont: UIFont, kButtonFont: UIFont)’

I modify just some of the arguments in SCLAppearance as:

    let appearance = SCLAlertView.SCLAppearance(
        kWindowWidth: width - 64,
        showCircularIcon: true,
        kCircleHeight: 0,
        kCircleIconHeight: width / 2,
        kTitleTop: width / 3.5,
        kTitleFont: UIFont(name: "ProximaNova-Bold", size: 20)!,
        kTextHeight: 50,
        kTextFont: UIFont(name: "ProximaNova-Regular", size: 14)!,
        kButtonFont: UIFont(name: "ProximaNova-Regular", size: 12)!   
    )

Do I have to fill all the arguments? And if so, how can I set the default values for the arguments I don’t want to change?

waseefakhtar avatar May 12 '17 16:05 waseefakhtar

I dealt with this in Swift 3 by passing arguments in ORDER as:

    SCLAlertView.SCLAppearance(kDefaultShadowOpacity: <#T##CGFloat#>, kCircleTopPosition: <#T##CGFloat#>, kCircleBackgroundTopPosition: <#T##CGFloat#>, kCircleHeight: <#T##CGFloat#>, kCircleIconHeight: <#T##CGFloat#>, kTitleTop: <#T##CGFloat#>, kTitleHeight: <#T##CGFloat#>, kWindowWidth: <#T##CGFloat#>, kWindowHeight: <#T##CGFloat#>, kTextHeight: <#T##CGFloat#>, kTextFieldHeight: <#T##CGFloat#>, kTextViewdHeight: <#T##CGFloat#>, kButtonHeight: <#T##CGFloat#>, kTitleFont: <#T##UIFont#>, kTextFont: <#T##UIFont#>, kButtonFont: <#T##UIFont#>, showCloseButton: <#T##Bool#>, showCircularIcon: <#T##Bool#>, shouldAutoDismiss: <#T##Bool#>, contentViewCornerRadius: <#T##CGFloat#>, fieldCornerRadius: <#T##CGFloat#>, buttonCornerRadius: <#T##CGFloat#>, hideWhenBackgroundViewIsTapped: <#T##Bool#>, contentViewColor: <#T##UIColor#>, contentViewBorderColor: <#T##UIColor#>, titleColor: <#T##UIColor#>)

This works also when only some of the arguments must be changed and not all.

waseefakhtar avatar May 16 '17 17:05 waseefakhtar

@waseefakhtar I don't get it, How to just leave the values at default if we do not want to change all?

hongzhou85 avatar May 17 '17 16:05 hongzhou85

This will be used in initialization function, so you should keep orders like this.

let appearance = SCLAlertView.SCLAppearance(
        kCircleHeight: 0,
        kCircleIconHeight: width / 2,
        kTitleTop: width / 3.5,
        kWindowWidth: width - 64,
        kTextHeight: 50,
        kTitleFont: UIFont(name: "ProximaNova-Bold", size: 20)!,
        kTextFont: UIFont(name: "ProximaNova-Regular", size: 14)!,
        kButtonFont: UIFont(name: "ProximaNova-Regular", size: 12)!,
        showCircularIcon: true
    )

I suggest you to check initializer of SCLAlertView.

devAstro81 avatar May 30 '17 18:05 devAstro81