forked from shaps80/SwiftUIBackports
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces a basic ShareLink implementation
- Loading branch information
Showing
8 changed files
with
264 additions
and
171 deletions.
There are no files selected for viewing
74 changes: 37 additions & 37 deletions
74
Sources/SwiftUIBackports/Shared/ShareLink/Multiple Items/Items+Label+Preview.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
import SwiftUI | ||
|
||
@available(iOS, deprecated: 16) | ||
@available(macOS, deprecated: 13) | ||
@available(watchOS, deprecated: 9) | ||
@available(tvOS, unavailable) | ||
public extension Backport.ShareLink where Wrapped == Any { | ||
init<S: StringProtocol>(_ title: S, items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
where Data.Element: BackportTransferable, Label == DefaultShareLinkLabel | ||
{ | ||
self.label = .init(title) | ||
self.data = items | ||
self.subject = subject | ||
self.message = message | ||
self.preview = preview | ||
} | ||
|
||
init(_ titleKey: LocalizedStringKey, items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
where Data.Element: BackportTransferable, Label == DefaultShareLinkLabel | ||
{ | ||
self.label = .init(titleKey) | ||
self.data = items | ||
self.subject = subject | ||
self.message = message | ||
self.preview = preview | ||
} | ||
|
||
init(_ title: Text, items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
where Data.Element: BackportTransferable, Label == DefaultShareLinkLabel | ||
{ | ||
self.label = .init(title) | ||
self.data = items | ||
self.subject = subject | ||
self.message = message | ||
self.preview = preview | ||
} | ||
} | ||
//import SwiftUI | ||
// | ||
//@available(iOS, deprecated: 16) | ||
//@available(macOS, deprecated: 13) | ||
//@available(watchOS, deprecated: 9) | ||
//@available(tvOS, unavailable) | ||
//public extension Backport.ShareLink where Wrapped == Any { | ||
// init<S: StringProtocol>(_ title: S, items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data.Element: Shareable, Label == DefaultShareLinkLabel | ||
// { | ||
// self.label = .init(title) | ||
// self.data = items | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = preview | ||
// } | ||
// | ||
// init(_ titleKey: LocalizedStringKey, items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data.Element: Shareable, Label == DefaultShareLinkLabel | ||
// { | ||
// self.label = .init(titleKey) | ||
// self.data = items | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = preview | ||
// } | ||
// | ||
// init(_ title: Text, items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data.Element: Shareable, Label == DefaultShareLinkLabel | ||
// { | ||
// self.label = .init(title) | ||
// self.data = items | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = preview | ||
// } | ||
//} |
50 changes: 25 additions & 25 deletions
50
Sources/SwiftUIBackports/Shared/ShareLink/Multiple Items/Items+Preview.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import SwiftUI | ||
|
||
@available(iOS, deprecated: 16) | ||
@available(macOS, deprecated: 13) | ||
@available(watchOS, deprecated: 9) | ||
@available(tvOS, unavailable) | ||
public extension Backport.ShareLink where Wrapped == Any { | ||
init(items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
where Data.Element: BackportTransferable, Label == DefaultShareLinkLabel { | ||
self.label = .init() | ||
self.data = items | ||
self.subject = subject | ||
self.message = message | ||
self.preview = preview | ||
} | ||
|
||
init(items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>, @ViewBuilder label: () -> Label) | ||
where Data.Element: BackportTransferable { | ||
self.label = label() | ||
self.data = items | ||
self.subject = subject | ||
self.message = message | ||
self.preview = preview | ||
} | ||
} | ||
//import SwiftUI | ||
// | ||
//@available(iOS, deprecated: 16) | ||
//@available(macOS, deprecated: 13) | ||
//@available(watchOS, deprecated: 9) | ||
//@available(tvOS, unavailable) | ||
//public extension Backport.ShareLink where Wrapped == Any { | ||
// init(items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data.Element: Shareable, Label == DefaultShareLinkLabel { | ||
// self.label = .init() | ||
// self.data = items | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = preview | ||
// } | ||
// | ||
// init(items: Data, subject: String? = nil, message: String? = nil, preview: @escaping (Data.Element) -> SharePreview<PreviewImage, PreviewIcon>, @ViewBuilder label: () -> Label) | ||
// where Data.Element: Shareable { | ||
// self.label = label() | ||
// self.data = items | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = preview | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 34 additions & 34 deletions
68
Sources/SwiftUIBackports/Shared/ShareLink/Single Item/Item+Label+Preview.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
import SwiftUI | ||
|
||
@available(iOS, deprecated: 16) | ||
@available(macOS, deprecated: 13) | ||
@available(watchOS, deprecated: 9) | ||
@available(tvOS, unavailable) | ||
public extension Backport.ShareLink where Wrapped == Any { | ||
init<S: StringProtocol, I: BackportTransferable>(_ title: S, item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
self.label = .init(title) | ||
self.data = .init(item) | ||
self.subject = subject | ||
self.message = message | ||
self.preview = { _ in preview } | ||
} | ||
|
||
init<I: BackportTransferable>(_ titleKey: LocalizedStringKey, item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
self.label = .init(titleKey) | ||
self.data = .init(item) | ||
self.subject = subject | ||
self.message = message | ||
self.preview = { _ in preview } | ||
} | ||
|
||
init<I: BackportTransferable>(_ title: Text, item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
self.label = .init(title) | ||
self.data = .init(item) | ||
self.subject = subject | ||
self.message = message | ||
self.preview = { _ in preview } | ||
} | ||
} | ||
//import SwiftUI | ||
// | ||
//@available(iOS, deprecated: 16) | ||
//@available(macOS, deprecated: 13) | ||
//@available(watchOS, deprecated: 9) | ||
//@available(tvOS, unavailable) | ||
//public extension Backport.ShareLink where Wrapped == Any { | ||
// init<S: StringProtocol, I: Shareable>(_ title: S, item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
// self.label = .init(title) | ||
// self.data = .init(item) | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = { _ in preview } | ||
// } | ||
// | ||
// init<I: Shareable>(_ titleKey: LocalizedStringKey, item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
// self.label = .init(titleKey) | ||
// self.data = .init(item) | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = { _ in preview } | ||
// } | ||
// | ||
// init<I: Shareable>(_ title: Text, item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
// self.label = .init(title) | ||
// self.data = .init(item) | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = { _ in preview } | ||
// } | ||
//} |
50 changes: 25 additions & 25 deletions
50
Sources/SwiftUIBackports/Shared/ShareLink/Single Item/Item+Preview.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import SwiftUI | ||
|
||
@available(iOS, deprecated: 16) | ||
@available(macOS, deprecated: 13) | ||
@available(watchOS, deprecated: 9) | ||
@available(tvOS, unavailable) | ||
public extension Backport.ShareLink where Wrapped == Any { | ||
init<I: BackportTransferable>(item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
self.label = .init() | ||
self.data = .init(item) | ||
self.subject = subject | ||
self.message = message | ||
self.preview = { _ in preview } | ||
} | ||
|
||
init<I: BackportTransferable>(item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>, @ViewBuilder label: () -> Label) | ||
where Data == CollectionOfOne<I> { | ||
self.label = label() | ||
self.data = .init(item) | ||
self.subject = subject | ||
self.message = message | ||
self.preview = { _ in preview } | ||
} | ||
} | ||
//import SwiftUI | ||
// | ||
//@available(iOS, deprecated: 16) | ||
//@available(macOS, deprecated: 13) | ||
//@available(watchOS, deprecated: 9) | ||
//@available(tvOS, unavailable) | ||
//public extension Backport.ShareLink where Wrapped == Any { | ||
// init<I: Shareable>(item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) | ||
// where Data == CollectionOfOne<I>, Label == DefaultShareLinkLabel { | ||
// self.label = .init() | ||
// self.data = .init(item) | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = { _ in preview } | ||
// } | ||
// | ||
// init<I: Shareable>(item: I, subject: String? = nil, message: String? = nil, preview: SharePreview<PreviewImage, PreviewIcon>, @ViewBuilder label: () -> Label) | ||
// where Data == CollectionOfOne<I> { | ||
// self.label = label() | ||
// self.data = .init(item) | ||
// self.subject = subject | ||
// self.message = message | ||
// self.preview = { _ in preview } | ||
// } | ||
//} |
Oops, something went wrong.