Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions en/tutorials/tipkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
```

Expand Down
19 changes: 14 additions & 5 deletions ru/tutorials/tipkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
```

Expand Down