-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathNCShareNavigationTitleSetting.swift
More file actions
29 lines (24 loc) · 1 KB
/
NCShareNavigationTitleSetting.swift
File metadata and controls
29 lines (24 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2025 Iva Horn
// SPDX-License-Identifier: GPL-3.0-or-later
import NextcloudKit
///
/// View controllers conforming to this gain the convenience method ``setNavigationTitle()`` to set the navigation title in a convenient and consistent way.
///
protocol NCShareNavigationTitleSetting {
var share: Shareable! { get }
}
// MARK: - UIViewController Extension
extension NCShareNavigationTitleSetting where Self: UIViewController {
///
/// Consolidated convenience method to set a view controller navigation title for a share.
///
func setNavigationTitle() {
title = NSLocalizedString("_share_", comment: "") + " – "
if share.shareType == NKShare.ShareType.publicLink.rawValue {
title! += share.label.isEmpty ? NSLocalizedString("_share_link_", comment: "") : share.label
} else {
title! += share.shareWithDisplayname.isEmpty ? share.shareWith : share.shareWithDisplayname
}
}
}