From e4d7467259d0ab9975bda4ab9c57f86d24ae53f7 Mon Sep 17 00:00:00 2001 From: "seongho.hong" Date: Fri, 30 Aug 2019 01:07:10 +0900 Subject: [PATCH] Add helper function for setting cornerRadius --- Demo/RootViewController.swift | 2 +- Sources/ToastView.swift | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Demo/RootViewController.swift b/Demo/RootViewController.swift index 1549211..c048b95 100644 --- a/Demo/RootViewController.swift +++ b/Demo/RootViewController.swift @@ -48,7 +48,7 @@ final class RootViewController: UIViewController { appearance.font = .boldSystemFont(ofSize: 16) appearance.textInsets = UIEdgeInsets(top: 15, left: 20, bottom: 15, right: 20) appearance.bottomOffsetPortrait = 100 - appearance.cornerRadius = 20 + appearance.cornerRadius = 20 // or use `appearance.cornerRadius(20)` if you are facing `Ambiguous use of cornerRadius` error. appearance.maxWidthRatio = 0.7 } diff --git a/Sources/ToastView.swift b/Sources/ToastView.swift index 0327cd2..914f63f 100644 --- a/Sources/ToastView.swift +++ b/Sources/ToastView.swift @@ -221,4 +221,9 @@ open class ToastView: UIView { return nil } + /// Helper function for setting cornerRadius to avoid conflicting with UIView extension. + @objc public dynamic func cornerRadius(_ cornerRadius: CGFloat) { + self.cornerRadius = cornerRadius + } + }