sparrowcode / AlertKit

Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.
https://sparrowcode.io/frameworks
MIT License
2.33k stars 131 forks source link

Fixed #7. The alert appeared behind the keyboard. #8

Closed tijme closed 4 years ago

tijme commented 4 years ago

Made keyWindow public so users can set their own parent view. This allows anyone to apply keyboard constraints as they want to.

An example how a user could use this;

import UIKit
import SPAlert

class ViewController: UIViewController {

    @IBOutlet weak var inputField: UITextField!

    @IBOutlet weak var wrapperView: UIView!

    override func viewDidLoad() {
        super.viewDidLoad()

        // attachKeyboardConstraint()

        inputField.becomeFirstResponder()
    }

    @IBAction func textField(_ sender: Any) {
        let alertView = SPAlertView(title: "Added to Library", message: nil, preset: SPAlertPreset.done)
        alertView.keyWindow = wrapperView
        alertView.present()
    }

}
ivanvorobei commented 4 years ago

Good day! Sorry long response. Many thanks for work, it good idea!

I am publish new version 2.0, you can merge from last master and add your code again?