Skip to content

Instantly share code, notes, and snippets.

@mono0926
Last active December 14, 2016 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mono0926/abd7d079361f36efdd9068b27b41ea50 to your computer and use it in GitHub Desktop.
Save mono0926/abd7d079361f36efdd9068b27b41ea50 to your computer and use it in GitHub Desktop.
rootViewController差し替え時のメモリリーク対策
let previousVC = window.rootViewController
window.rootViewController = vc
// あとから閉じてるけど、先でも良いかも(要検証)
if let previousVC = previousVC {
previousVC.dismiss(animated: false) {
// これ不要かも(要検証)
previousVC.view.removeFromSuperview()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment