Closed Youngminah closed 2 years ago
import UIKit
class ViewController: UIViewController {
func transitionViewController<T: UIViewController> (sb: String, vc: T) {
let sb = UIStoryboard(name: sb, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: vc) as! T
self.present(vc, animated: true, completion: nil)
}
}
제네릭 예제
Type Constraints in Action
응용 편: Associated Type