diff --git a/en/tutorials/tipkit.md b/en/tutorials/tipkit.md index c0ded781..7d816ff5 100644 --- a/en/tutorials/tipkit.md +++ b/en/tutorials/tipkit.md @@ -261,19 +261,28 @@ In the method, provide a reason why you closed the tip: - `.displayCountExceeded` - the tip has been shown the maximum number of times - `.tipClosed` - the user has clearly closed the tip -In UIKit, you need to add code for the cross. For `popover`-tip, close the controller: +In UIKit, you need to add code for the cross. +For `popover`-tip, close the controller: ```swift -if presentedViewController is TipUIPopoverViewController { - dismiss(animated: true) +if shouldDisplay { + ... +} else { + if presentedViewController is TipUIPopoverViewController { + dismiss(animated: true) + } } ``` For the `inline`-tip, we remove the view: ```swift -if let tipView = view.subviews.first(where: { $0 is TipUIView }) { - tipView.removeFromSuperview() +if shouldDisplay { + ... +} else { + if let tipView = view.subviews.first(where: { $0 is TipUIView }) { + tipView.removeFromSuperview() + } } ``` diff --git a/ru/tutorials/tipkit.md b/ru/tutorials/tipkit.md index d535714b..77fd3945 100644 --- a/ru/tutorials/tipkit.md +++ b/ru/tutorials/tipkit.md @@ -261,19 +261,28 @@ inlineTip.invalidate(reason: .actionPerformed) - `.displayCountExceeded` - подсказку показали максимальное количество раз - `.tipClosed` - пользователь явно закрыл подсказку -В UIKit для крестика нужно дописать код. Для `popover`-подсказки закрываем контроллер: +В UIKit для крестика нужно дописать код. +Для `popover`-подсказки закрываем контроллер: ```swift -if presentedViewController is TipUIPopoverViewController { - dismiss(animated: true) +if shouldDisplay { + ... +} else { + if presentedViewController is TipUIPopoverViewController { + dismiss(animated: true) + } } ``` Для `inline`-подсказки удаляем вью: ```swift -if let tipView = view.subviews.first(where: { $0 is TipUIView }) { - tipView.removeFromSuperview() +if shouldDisplay { + ... +} else { + if let tipView = view.subviews.first(where: { $0 is TipUIView }) { + tipView.removeFromSuperview() + } } ```