ios 15 support

gotta fix how swiftui is displayed inside my tableviewcells
This commit is contained in:
neon443 committed 2026-04-10 23:36:21 +01:00
1 parent 08cb845139
commit 39c8457c3e
19 files changed
+219 -43

No files matched your search

+22 -2
View File
@@ -112,6 +112,13 @@
A9C52F6B2F8988CE00078588 /* EmptyCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */; };
A9C52F6C2F8988CE00078588 /* EmptyCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */; };
A9C52F6D2F8988CE00078588 /* EmptyCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */; };
A9C52F6F2F89A22000078588 /* Wiggle.metal in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6E2F89A22000078588 /* Wiggle.metal */; };
A9C52F702F89A22000078588 /* Wiggle.metal in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6E2F89A22000078588 /* Wiggle.metal */; };
A9C52F722F89A85F00078588 /* ShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F712F89A85F00078588 /* ShareSheet.swift */; };
A9C52F732F89A85F00078588 /* ShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F712F89A85F00078588 /* ShareSheet.swift */; };
A9C52F752F89A93D00078588 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F742F89A93D00078588 /* URL.swift */; };
A9C52F762F89A93D00078588 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F742F89A93D00078588 /* URL.swift */; };
A9C52F772F89A9BF00078588 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F742F89A93D00078588 /* URL.swift */; };
A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */; };
A9CD6C362EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */; };
A9CD6C382EDDE37500B7F421 /* EmojiPackManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */; };
@@ -219,6 +226,9 @@
A9BE30FD2F5FA47100A57668 /* Hoarder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hoarder.swift; sourceTree = "<group>"; };
A9C172DB2EB8C9AC008A7885 /* Trie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trie.swift; sourceTree = "<group>"; };
A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyCollectionView.swift; sourceTree = "<group>"; };
A9C52F6E2F89A22000078588 /* Wiggle.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Wiggle.metal; sourceTree = "<group>"; };
A9C52F712F89A85F00078588 /* ShareSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareSheet.swift; sourceTree = "<group>"; };
A9C52F742F89A93D00078588 /* URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = "<group>"; };
A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackDetailView.swift; sourceTree = "<group>"; };
A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackManager.swift; sourceTree = "<group>"; };
A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; };
@@ -276,6 +286,7 @@
A957C1762ECD008E00EA3EE9 /* Bundle.swift */,
A9A7A4672F6AA17C00BB84C6 /* Int.swift */,
A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */,
A9C52F742F89A93D00078588 /* URL.swift */,
);
path = Extensions;
sourceTree = "<group>";
@@ -304,6 +315,7 @@
A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */,
A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */,
A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */,
A9C52F6E2F89A22000078588 /* Wiggle.metal */,
);
path = EmojiPacks;
sourceTree = "<group>";
@@ -328,6 +340,7 @@
isa = PBXGroup;
children = (
A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */,
A9C52F712F89A85F00078588 /* ShareSheet.swift */,
);
path = UIKit;
sourceTree = "<group>";
@@ -652,10 +665,12 @@
A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */,
A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */,
A9C52F6F2F89A22000078588 /* Wiggle.metal in Sources */,
A9BDEADE2F82BC93002798DF /* NoStickersView.swift in Sources */,
A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */,
A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */,
A9C52F6D2F8988CE00078588 /* EmptyCollectionView.swift in Sources */,
A9C52F752F89A93D00078588 /* URL.swift in Sources */,
A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */,
A9F7B3812F8951210071F198 /* EmojiPackImporterView.swift in Sources */,
A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */,
@@ -679,6 +694,7 @@
A9A7A4482F68361200BB84C6 /* Meta.swift in Sources */,
A995D95C2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */,
A9BE30FE2F5FA47100A57668 /* Hoarder.swift in Sources */,
A9C52F722F89A85F00078588 /* ShareSheet.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -697,6 +713,7 @@
A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */,
A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */,
A9C52F6C2F8988CE00078588 /* EmptyCollectionView.swift in Sources */,
A9C52F772F89A9BF00078588 /* URL.swift in Sources */,
A9A7A4582F69569100BB84C6 /* Trending.swift in Sources */,
A9A7A4592F69569100BB84C6 /* Pagination.swift in Sources */,
A9A7A45A2F69569100BB84C6 /* Meta.swift in Sources */,
@@ -722,13 +739,16 @@
A9A7A4462F68360900BB84C6 /* Pagination.swift in Sources */,
A957C17C2ECE542D00EA3EE9 /* GifManager.swift in Sources */,
A9104C7F2EB4022500D160EA /* MSSticker.swift in Sources */,
A9C52F762F89A93D00078588 /* URL.swift in Sources */,
A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */,
A9C52F702F89A22000078588 /* Wiggle.metal in Sources */,
A955B3F12EC22E9700E1732D /* BrowseView.swift in Sources */,
A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */,
A9F7B3802F8951210071F198 /* EmojiPackImporterView.swift in Sources */,
A9BE30F72F5B011A00A57668 /* StickerProtocol.swift in Sources */,
A9C52F6B2F8988CE00078588 /* EmptyCollectionView.swift in Sources */,
A9BE30FC2F5B03F400A57668 /* Sticker.swift in Sources */,
A9C52F732F89A85F00078588 /* ShareSheet.swift in Sources */,
A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */,
A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */,
A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */,
@@ -935,7 +955,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13;
@@ -987,7 +1007,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13;
@@ -23,7 +23,7 @@ struct EmojiPack: Identifiable, Codable {
}
init(fromShareLink url: URL) {
guard url.scheme == "stickerslack" && url.host() == "shared.pack" else { fatalError("invalid share url") }
guard url.scheme == "stickerslack" && url.safeHost == "shared.pack" else { fatalError("invalid share url") }
guard let components = URLComponents(string: url.absoluteString),
let queryItems = components.queryItems else { fatalError("no query items or components") }
@@ -81,7 +81,10 @@ struct EmojiPack: Identifiable, Codable {
.init(name: "description", value: description),
.init(name: "items", value: data.base64EncodedString())
]
url = url.appending(queryItems: queries)
var components = URLComponents(url: url, resolvingAgainstBaseURL: false)
components!.queryItems = queries
url = components!.url!
return url
}
}
+2 -2
View File
@@ -34,7 +34,7 @@ class EmojiHoarder: BaseHoarder {
super.init()
self.showWelcome = !UserDefaults.standard.bool(forKey: "showWelcome")
if !FileManager.default.fileExists(atPath: EmojiHoarder.container.path()) {
if !FileManager.default.fileExists(atPath: EmojiHoarder.container.safePath) {
try! FileManager.default.createDirectory(at: EmojiHoarder.container, withIntermediateDirectories: true)
}
@@ -131,7 +131,7 @@ class EmojiHoarder: BaseHoarder {
}
private func loadTrie() {
guard FileManager.default.fileExists(atPath: EmojiHoarder.localTrieDict.path()) else { return }
guard FileManager.default.fileExists(atPath: EmojiHoarder.localTrieDict.safePath) else { return }
guard let dataDict = try? Data(contentsOf: EmojiHoarder.localTrieDict) else { return }
guard let decodedDict = try? decoder.decode([String:Emoji].self, from: dataDict) else {
fatalError("failed to decode dict")
+26
View File
@@ -0,0 +1,26 @@
//
// URL.swift
// StickerSlack
//
// Created by neon443 on 10/04/2026.
//
import Foundation
extension URL {
nonisolated var safePath: String {
if #available(iOS 16, *) {
return self.path()
} else {
return self.path
}
}
nonisolated var safeHost: String? {
if #available(iOS 16, *) {
return self.host()
} else {
return self.host
}
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ class GifHoarder: BaseHoarder {
init(localOnly: Bool = false) {
super.init()
if !FileManager.default.fileExists(atPath: GifHoarder.container.path()) {
if !FileManager.default.fileExists(atPath: GifHoarder.container.safePath) {
try! FileManager.default.createDirectory(at: GifHoarder.container, withIntermediateDirectories: true)
}
startLoadingTrending()
+2 -1
View File
@@ -50,7 +50,8 @@ class BaseHoarder: Hoarder {
} else {
var newSet: Set<String> = []
let url = await BaseHoarder.library.appendingPathComponent(stickerType, conformingTo: .directory)
if let files = try? FileManager.default.contentsOfDirectory(atPath: url.path()) {
if let files = try? FileManager.default.contentsOfDirectory(atPath: url.safePath) {
for file in files {
let name = String(file.split(separator: ".")[0])
newSet.insert(name)
+7 -3
View File
@@ -12,9 +12,9 @@ extension StickerProtocol {
var localImageURLString: String {
let containerPath: String
if type(of: self) == Emoji.self {
containerPath = EmojiHoarder.container.path()
containerPath = EmojiHoarder.container.safePath
} else if type(of: self) == Gif.self {
containerPath = GifHoarder.container.path()
containerPath = GifHoarder.container.safePath
} else {
fatalError("sticker type unrecogniesd")
}
@@ -25,7 +25,11 @@ extension StickerProtocol {
}
var localImageURL: URL {
return URL(filePath: localImageURLString)
if #available(iOS 16, *) {
return URL(filePath: localImageURLString)
} else {
return URL(fileURLWithPath: localImageURLString)
}
}
var msSticker: MSSticker? {
+1 -1
View File
@@ -56,7 +56,7 @@ struct ContentView: View {
.tabItem {
Label("Setings", systemImage: "gear")
}
NavigationStack {
NavigationView2 {
SearchView(hoarder: emojiHoarder)
}
.tabItem {
+1 -1
View File
@@ -62,7 +62,7 @@ struct DownloadedView: View {
UIPasteboard.general.image = emoji.image
}
Divider()
ShareLink("Share", item: emoji.remoteImageURL, subject: nil, message: nil)
// ShareLink("Share", item: emoji.remoteImageURL, subject: nil, message: nil)
Divider()
Button("Delete", systemImage: "trash.fill", role: .destructive) {
emojiHoarder.delete(emoji: emoji)
@@ -29,7 +29,7 @@ struct EmojiPackDetailView: View {
@Environment(\.dismiss) var dismiss
var body: some View {
NavigationStack {
NavigationView2 {
GeometryReader { geo in
ScrollView {
Button() {
@@ -110,11 +110,16 @@ struct EmojiPackDetailView: View {
.padding(-10)
}
}
.rotationEffect(
.degrees(
edit ? sin(initDate.timeIntervalSinceNow*20)*4 : 0
)
)
// .distortionEffect(
// ShaderLibrary.wiggle(.float(initDate.timeIntervalSinceNow)),
// maxSampleOffset: .zero,
// isEnabled: edit
// )
// .rotationEffect(
// .degrees(
// edit ? sin(initDate.timeIntervalSinceNow*20)*4 : 0
// )
// )
}
}
if edit {
@@ -133,14 +138,13 @@ struct EmojiPackDetailView: View {
}
}
.sheet(isPresented: $showAdder) {
NavigationStack {
NavigationView2 {
SearchView(hoarder: hoarder, fromPackEditor: true) { selection in
pack.add(selection.name)
}
.navigationTitle("Search Emojis")
.navigationBarTitleDisplayMode(.inline)
.presentationDragIndicator(.visible)
.presentationDetents([.large, .medium])
.modifier(presentationHalfAndFullIfAv())
.toolbar {
Button("", systemImage: "xmark") {
showAdder.toggle()
@@ -171,13 +175,19 @@ struct EmojiPackDetailView: View {
.modifier(glassButtonIfAv(edit))
.tint(edit ? Color.accentColor : .primary)
}
if #available(iOS 19, *) {
ToolbarSpacer()
}
// if #available(iOS 19, *) {
// ToolbarSpacer()
// }
ToolbarItem {
ShareLink(item: pack.shareLink()) {
Image(systemName: "square.and.arrow.up")
Button("", systemImage: "square.and.arrow.up") {
}
.sheet(isPresented: .constant(true)) {
ShareSheet(activityItems: [pack.shareLink()])
}
// ShareLink(item: pack.shareLink()) {
// Image(systemName: "square.and.arrow.up")
// }
}
}
.onDisappear {
@@ -11,7 +11,7 @@ struct EmojiPackManager: View {
@ObservedObject var hoarder: EmojiHoarder
var body: some View {
NavigationStack {
NavigationView2 {
List {
if hoarder.emojiPacks.isEmpty {
EmptyCollectionView(
@@ -0,0 +1,15 @@
//
// Wiggle.metal
// StickerSlack
//
// Created by neon443 on 10/04/2026.
//
#include <metal_stdlib>
#include <SwiftUI/SwiftUI_Metal.h>
using namespace metal;
[[stitchable]] float2 wiggle(float2 pos, half4 color, float time) {
// pos.x
return pos;
}
@@ -47,3 +47,75 @@ struct glassButtonIfAv: ViewModifier {
}
}
}
struct NavigationView2<T: View>: View {
@ViewBuilder var contents: T
var body: some View {
if #available(iOS 16, *) {
NavigationStack {
contents
}
} else {
NavigationView {
contents
}
}
}
}
struct presentationHalfAndFullIfAv: ViewModifier {
func body(content: Content) -> some View {
if #available(iOS 16, *) {
content
.presentationDetents([.medium, .large])
.presentationDragIndicator(.visible)
} else {
content
}
}
}
struct BoldSafe: ViewModifier {
var isEnabled: Bool = true
var style: Font.TextStyle = .body
func body(content: Content) -> some View {
if #available(iOS 16, *) {
content.bold(isEnabled)
} else {
if isEnabled {
content.font(.system(style).bold())
} else {
content.font(.system(style))
}
}
}
}
struct MonospacedSafe: ViewModifier {
var isEnabled: Bool = true
var style: Font.TextStyle = .body
func body(content: Content) -> some View {
if #available(iOS 16, *) {
content.monospaced(isEnabled)
} else {
if isEnabled {
content.font(.system(style).monospaced())
} else {
content.font(.system(style))
}
}
}
}
struct ScrollContentBackgroundHidden: ViewModifier {
func body(content: Content) -> some View {
if #available(iOS 16, *) {
content.scrollContentBackground(.hidden)
} else {
content
}
}
}
+2 -4
View File
@@ -16,7 +16,7 @@ struct SettingsView: View {
return colorScheme == .dark
}
var body: some View {
NavigationStack {
NavigationView2 {
List {
Section {
HStack {
@@ -30,9 +30,7 @@ struct SettingsView: View {
.padding(.trailing, 10)
VStack(alignment: .leading) {
Text("StickerSlack")
.font(.title2)
.monospaced()
.bold()
.font(.title2.monospaced().bold())
HStack(alignment: .center, spacing: 5) {
Text(Bundle.main.appVersion)
.bold()
+1 -2
View File
@@ -26,8 +26,7 @@ struct StickerRow<T: Hoarder>: View {
VStack(alignment: .leading, spacing: 5) {
Text(sticker.UIName)
.font(.caption)
.bold(isDownloaded)
.font(.caption.bold())
.foregroundColor(isDownloaded ? .green : .primary)
.lineLimit(nil)
.multilineTextAlignment(.leading)
+2 -3
View File
@@ -23,8 +23,7 @@ struct WelcomeView: View {
Spacer()
Text("StickerSlack")
.bold()
.font(.largeTitle)
.monospaced()
.font(.largeTitle.monospaced())
Spacer()
}
.padding(.vertical, 20)
@@ -39,7 +38,7 @@ struct WelcomeView: View {
ListRow(number: 6, text: "Tap an emoji to use it!")
}
}
.scrollContentBackground(.hidden)
.modifier(ScrollContentBackgroundHidden())
Spacer()
Group {
if #available(iOS 19, *) {
+7 -5
View File
@@ -60,7 +60,6 @@ struct EmojiTableView: UIViewRepresentable {
spinner.frame = cell.frame
spinner.autoresizingMask = .flexibleWidth
cell.addSubview(spinner)
tableView.reloadData()
return cell
}
let emojiName = items[indexPath.row]
@@ -69,10 +68,13 @@ struct EmojiTableView: UIViewRepresentable {
cell.selectedBackgroundView = nil
cell.selectionStyle = .none
cell.contentConfiguration = UIHostingConfiguration {
StickerRow(hoarder: hoarder, sticker: emoji)
.id(emoji)
}
let swiftUIView = StickerRow(hoarder: hoarder, sticker: emoji).id(emoji)
let hostingController = UIHostingController(rootView: swiftUIView)
hostingController.view.frame = cell.frame
hostingController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
cell.addSubview(hostingController.view)
return cell
}
+27
View File
@@ -0,0 +1,27 @@
//
// ShareSheet.swift
// StickerSlack
//
// Created by neon443 on 10/04/2026.
//
import Foundation
import UIKit
import SwiftUI
struct ShareSheet: UIViewControllerRepresentable {
let activityItems: [Any]
let applicationActivities: [UIActivity]? = nil
func makeUIViewController(context: Context) -> UIActivityViewController {
let controller = UIActivityViewController(
activityItems: activityItems,
applicationActivities: applicationActivities
)
return controller
}
func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {
// <#code#>
}
}
@@ -17,7 +17,7 @@ class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource {
override init() {
super.init()
msStickers = []
guard let files = try? FileManager.default.contentsOfDirectory(atPath: EmojiHoarder.container.path()) else { return }
guard let files = try? FileManager.default.contentsOfDirectory(atPath: EmojiHoarder.container.safePath) else { return }
for file in files {
guard file.contains(".png") ||
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.