This commit is contained in:
Shadowfacts 2022-07-03 16:00:17 -07:00
parent 2b0ab45c12
commit 17cb8676b1
16 changed files with 857 additions and 4 deletions

View File

@ -7,6 +7,16 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
D626E6C628724258000E1AF5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6C528724258000E1AF5 /* AppDelegate.swift */; };
D626E6C828724258000E1AF5 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6C728724258000E1AF5 /* SceneDelegate.swift */; };
D626E6CA28724258000E1AF5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6C928724258000E1AF5 /* ViewController.swift */; };
D626E6CF28724259000E1AF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D626E6CE28724259000E1AF5 /* Assets.xcassets */; };
D626E6D228724259000E1AF5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D626E6D028724259000E1AF5 /* LaunchScreen.storyboard */; };
D626E6D8287242F0000E1AF5 /* MastoSearchCore in Frameworks */ = {isa = PBXBuildFile; productRef = D626E6D7287242F0000E1AF5 /* MastoSearchCore */; };
D626E6DA287242F2000E1AF5 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = D626E6D9287242F2000E1AF5 /* SwiftSoup */; };
D626E6DC28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DB28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift */; };
D626E6DE28724D4C000E1AF5 /* StatusTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DD28724D4C000E1AF5 /* StatusTableHeaderView.swift */; };
D626E6E028725940000E1AF5 /* UIColor+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DF28725940000E1AF5 /* UIColor+App.swift */; };
D6451241276981A40046CCD2 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6451240276981A40046CCD2 /* WindowController.swift */; }; D6451241276981A40046CCD2 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6451240276981A40046CCD2 /* WindowController.swift */; };
D6559A5228721BAF000EEB4D /* MastoSearchCore in Frameworks */ = {isa = PBXBuildFile; productRef = D6559A5128721BAF000EEB4D /* MastoSearchCore */; }; D6559A5228721BAF000EEB4D /* MastoSearchCore in Frameworks */ = {isa = PBXBuildFile; productRef = D6559A5128721BAF000EEB4D /* MastoSearchCore */; };
D669039E2769236F00819C4D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D669039C2769236F00819C4D /* ViewController.swift */; }; D669039E2769236F00819C4D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D669039C2769236F00819C4D /* ViewController.swift */; };
@ -29,6 +39,16 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
D626E6C328724258000E1AF5 /* MastoSearchMobile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MastoSearchMobile.app; sourceTree = BUILT_PRODUCTS_DIR; };
D626E6C528724258000E1AF5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D626E6C728724258000E1AF5 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
D626E6C928724258000E1AF5 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
D626E6CE28724259000E1AF5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
D626E6D128724259000E1AF5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
D626E6D328724259000E1AF5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D626E6DB28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableRowCollectionViewCell.swift; sourceTree = "<group>"; };
D626E6DD28724D4C000E1AF5 /* StatusTableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableHeaderView.swift; sourceTree = "<group>"; };
D626E6DF28725940000E1AF5 /* UIColor+App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+App.swift"; sourceTree = "<group>"; };
D6451240276981A40046CCD2 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = "<group>"; }; D6451240276981A40046CCD2 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = "<group>"; };
D669039C2769236F00819C4D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; D669039C2769236F00819C4D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
D66903BD2769250B00819C4D /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; }; D66903BD2769250B00819C4D /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
@ -43,6 +63,15 @@
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
D626E6C028724258000E1AF5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D626E6D8287242F0000E1AF5 /* MastoSearchCore in Frameworks */,
D626E6DA287242F2000E1AF5 /* SwiftSoup in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D6A4B8AA27C2B1770016F458 /* Frameworks */ = { D6A4B8AA27C2B1770016F458 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -62,6 +91,22 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
D626E6C428724258000E1AF5 /* MastoSearchMobile */ = {
isa = PBXGroup;
children = (
D626E6C528724258000E1AF5 /* AppDelegate.swift */,
D626E6C728724258000E1AF5 /* SceneDelegate.swift */,
D626E6C928724258000E1AF5 /* ViewController.swift */,
D626E6DB28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift */,
D626E6DD28724D4C000E1AF5 /* StatusTableHeaderView.swift */,
D626E6DF28725940000E1AF5 /* UIColor+App.swift */,
D626E6CE28724259000E1AF5 /* Assets.xcassets */,
D626E6D028724259000E1AF5 /* LaunchScreen.storyboard */,
D626E6D328724259000E1AF5 /* Info.plist */,
);
path = MastoSearchMobile;
sourceTree = "<group>";
};
D6559A5028721BAF000EEB4D /* Frameworks */ = { D6559A5028721BAF000EEB4D /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -84,6 +129,7 @@
D6E77D1428721A7600D8B732 /* MastoSearchCore */, D6E77D1428721A7600D8B732 /* MastoSearchCore */,
D6B24DE727640CE100BA23B8 /* MastoSearch */, D6B24DE727640CE100BA23B8 /* MastoSearch */,
D6A4B8AE27C2B1770016F458 /* MastoSearchTests */, D6A4B8AE27C2B1770016F458 /* MastoSearchTests */,
D626E6C428724258000E1AF5 /* MastoSearchMobile */,
D6B24DE627640CE100BA23B8 /* Products */, D6B24DE627640CE100BA23B8 /* Products */,
D6559A5028721BAF000EEB4D /* Frameworks */, D6559A5028721BAF000EEB4D /* Frameworks */,
); );
@ -94,6 +140,7 @@
children = ( children = (
D6B24DE527640CE100BA23B8 /* MastoSearch.app */, D6B24DE527640CE100BA23B8 /* MastoSearch.app */,
D6A4B8AD27C2B1770016F458 /* MastoSearchTests.xctest */, D6A4B8AD27C2B1770016F458 /* MastoSearchTests.xctest */,
D626E6C328724258000E1AF5 /* MastoSearchMobile.app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -114,6 +161,27 @@
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
D626E6C228724258000E1AF5 /* MastoSearchMobile */ = {
isa = PBXNativeTarget;
buildConfigurationList = D626E6D628724259000E1AF5 /* Build configuration list for PBXNativeTarget "MastoSearchMobile" */;
buildPhases = (
D626E6BF28724258000E1AF5 /* Sources */,
D626E6C028724258000E1AF5 /* Frameworks */,
D626E6C128724258000E1AF5 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = MastoSearchMobile;
packageProductDependencies = (
D626E6D7287242F0000E1AF5 /* MastoSearchCore */,
D626E6D9287242F2000E1AF5 /* SwiftSoup */,
);
productName = MastoSearchMobile;
productReference = D626E6C328724258000E1AF5 /* MastoSearchMobile.app */;
productType = "com.apple.product-type.application";
};
D6A4B8AC27C2B1770016F458 /* MastoSearchTests */ = { D6A4B8AC27C2B1770016F458 /* MastoSearchTests */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = D6A4B8B327C2B1770016F458 /* Build configuration list for PBXNativeTarget "MastoSearchTests" */; buildConfigurationList = D6A4B8B327C2B1770016F458 /* Build configuration list for PBXNativeTarget "MastoSearchTests" */;
@ -160,9 +228,12 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
BuildIndependentTargetsInParallel = 1; BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1320; LastSwiftUpdateCheck = 1400;
LastUpgradeCheck = 1320; LastUpgradeCheck = 1320;
TargetAttributes = { TargetAttributes = {
D626E6C228724258000E1AF5 = {
CreatedOnToolsVersion = 14.0;
};
D6A4B8AC27C2B1770016F458 = { D6A4B8AC27C2B1770016F458 = {
CreatedOnToolsVersion = 13.2; CreatedOnToolsVersion = 13.2;
TestTargetID = D6B24DE427640CE100BA23B8; TestTargetID = D6B24DE427640CE100BA23B8;
@ -191,11 +262,21 @@
targets = ( targets = (
D6B24DE427640CE100BA23B8 /* MastoSearch */, D6B24DE427640CE100BA23B8 /* MastoSearch */,
D6A4B8AC27C2B1770016F458 /* MastoSearchTests */, D6A4B8AC27C2B1770016F458 /* MastoSearchTests */,
D626E6C228724258000E1AF5 /* MastoSearchMobile */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
D626E6C128724258000E1AF5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D626E6D228724259000E1AF5 /* LaunchScreen.storyboard in Resources */,
D626E6CF28724259000E1AF5 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D6A4B8AB27C2B1770016F458 /* Resources */ = { D6A4B8AB27C2B1770016F458 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -215,6 +296,19 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
D626E6BF28724258000E1AF5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D626E6DE28724D4C000E1AF5 /* StatusTableHeaderView.swift in Sources */,
D626E6DC28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift in Sources */,
D626E6CA28724258000E1AF5 /* ViewController.swift in Sources */,
D626E6C628724258000E1AF5 /* AppDelegate.swift in Sources */,
D626E6C828724258000E1AF5 /* SceneDelegate.swift in Sources */,
D626E6E028725940000E1AF5 /* UIColor+App.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D6A4B8A927C2B1770016F458 /* Sources */ = { D6A4B8A927C2B1770016F458 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -244,7 +338,87 @@
}; };
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
D626E6D028724259000E1AF5 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
D626E6D128724259000E1AF5 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
D626E6D428724259000E1AF5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = HGYVAQA9FW;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MastoSearchMobile/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = MastoSearch;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.MastoSearchMobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 2;
};
name = Debug;
};
D626E6D528724259000E1AF5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = HGYVAQA9FW;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MastoSearchMobile/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = MastoSearch;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.MastoSearchMobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 2;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
D6A4B8B427C2B1770016F458 /* Debug */ = { D6A4B8B427C2B1770016F458 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
@ -453,6 +627,15 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
D626E6D628724259000E1AF5 /* Build configuration list for PBXNativeTarget "MastoSearchMobile" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D626E6D428724259000E1AF5 /* Debug */,
D626E6D528724259000E1AF5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D6A4B8B327C2B1770016F458 /* Build configuration list for PBXNativeTarget "MastoSearchTests" */ = { D6A4B8B327C2B1770016F458 /* Build configuration list for PBXNativeTarget "MastoSearchTests" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
@ -502,6 +685,15 @@
/* End XCRemoteSwiftPackageReference section */ /* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */ /* Begin XCSwiftPackageProductDependency section */
D626E6D7287242F0000E1AF5 /* MastoSearchCore */ = {
isa = XCSwiftPackageProductDependency;
productName = MastoSearchCore;
};
D626E6D9287242F2000E1AF5 /* SwiftSoup */ = {
isa = XCSwiftPackageProductDependency;
package = D66903BF27692EAB00819C4D /* XCRemoteSwiftPackageReference "SwiftSoup" */;
productName = SwiftSoup;
};
D6559A5128721BAF000EEB4D /* MastoSearchCore */ = { D6559A5128721BAF000EEB4D /* MastoSearchCore */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
productName = MastoSearchCore; productName = MastoSearchCore;

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D626E6C228724258000E1AF5"
BuildableName = "MastoSearchMobile.app"
BlueprintName = "MastoSearchMobile"
ReferencedContainer = "container:MastoSearch.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D626E6C228724258000E1AF5"
BuildableName = "MastoSearchMobile.app"
BlueprintName = "MastoSearchMobile"
ReferencedContainer = "container:MastoSearch.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D626E6C228724258000E1AF5"
BuildableName = "MastoSearchMobile.app"
BlueprintName = "MastoSearchMobile"
ReferencedContainer = "container:MastoSearch.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -9,9 +9,19 @@
<key>orderHint</key> <key>orderHint</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<key>MastoSearchMobile.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
</dict> </dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>
<dict> <dict>
<key>D626E6C228724258000E1AF5</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>D6A4B8AC27C2B1770016F458</key> <key>D6A4B8AC27C2B1770016F458</key>
<dict> <dict>
<key>primary</key> <key>primary</key>

View File

@ -734,7 +734,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView identifier="date" id="yUJ-7Q-rvg"> <tableCellView identifier="date" id="yUJ-7Q-rvg">
<rect key="frame" x="18" y="0.0" width="146" height="24"/> <rect key="frame" x="8" y="0.0" width="146" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField identifier="dateCell" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kPp-F2-rtb"> <textField identifier="dateCell" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kPp-F2-rtb">
@ -767,7 +767,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView identifier="contentWarning" id="m4I-Cd-y2k"> <tableCellView identifier="contentWarning" id="m4I-Cd-y2k">
<rect key="frame" x="181" y="0.0" width="173" height="24"/> <rect key="frame" x="171" y="0.0" width="173" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField identifier="contentWarningCell" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zz1-AR-4EW"> <textField identifier="contentWarningCell" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zz1-AR-4EW">
@ -800,7 +800,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView identifier="content" id="BHM-ku-S45"> <tableCellView identifier="content" id="BHM-ku-S45">
<rect key="frame" x="371" y="0.0" width="303" height="17"/> <rect key="frame" x="361" y="0.0" width="303" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Hwo-JH-icI"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Hwo-JH-icI">

View File

@ -7,6 +7,7 @@ let package = Package(
name: "MastoSearchCore", name: "MastoSearchCore",
platforms: [ platforms: [
.macOS(.v12), .macOS(.v12),
.iOS(.v15),
], ],
products: [ products: [
// Products define the executables and libraries a package produces, and make them visible to other packages. // Products define the executables and libraries a package produces, and make them visible to other packages.

View File

@ -0,0 +1,32 @@
//
// AppDelegate.swift
// MastoSearchMobile
//
// Created by Shadowfacts on 7/3/22.
//
import UIKit
import MastoSearchCore
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
DatabaseController.shared.initialize()
return true
}
func applicationWillTerminate(_ application: UIApplication) {
DatabaseController.shared.close()
}
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
}
}

View File

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,69 @@
//
// SceneDelegate.swift
// MastoSearchMobile
//
// Created by Shadowfacts on 7/3/22.
//
import UIKit
import MastoSearchCore
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
let nav = UINavigationController(rootViewController: ViewController())
nav.navigationBar.scrollEdgeAppearance = nav.navigationBar.standardAppearance
window!.rootViewController = nav
window!.makeKeyAndVisible()
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
syncStatuses()
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
func syncStatuses() {
SyncController.shared.syncStatuses { error in
let alert = UIAlertController(title: "Error syncing statuses", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default))
self.window!.rootViewController!.present(alert, animated: true)
}
}
}

View File

@ -0,0 +1,75 @@
//
// StatusTableHeaderView.swift
// MastoSearchMobile
//
// Created by Shadowfacts on 7/3/22.
//
import UIKit
class StatusTableHeaderView: UICollectionReusableView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .systemBackground
let dateLabel = UILabel()
dateLabel.text = "Date"
dateLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .callout).withSymbolicTraits(.traitBold)!, size: 0)
dateLabel.textColor = .tintColor
dateLabel.translatesAutoresizingMaskIntoConstraints = false
addSubview(dateLabel)
let contentWarningLabel = UILabel()
contentWarningLabel.text = "Content Warning"
contentWarningLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .callout).withSymbolicTraits(.traitBold)!, size: 0)
contentWarningLabel.textColor = .tintColor
contentWarningLabel.translatesAutoresizingMaskIntoConstraints = false
addSubview(contentWarningLabel)
let contentLabel = UILabel()
contentLabel.text = "Content"
contentLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .callout).withSymbolicTraits(.traitBold)!, size: 0)
contentLabel.textColor = .tintColor
contentLabel.translatesAutoresizingMaskIntoConstraints = false
addSubview(contentLabel)
let fakeDateLabel = UILabel()
fakeDateLabel.text = "07/03/2022, 02:31 PM"
fakeDateLabel.translatesAutoresizingMaskIntoConstraints = false
fakeDateLabel.font = .monospacedDigitSystemFont(ofSize: 17, weight: .regular)
fakeDateLabel.isHidden = true
addSubview(fakeDateLabel)
let separator = UIView()
separator.backgroundColor = .separator
separator.translatesAutoresizingMaskIntoConstraints = false
addSubview(separator)
NSLayoutConstraint.activate([
dateLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: leadingAnchor, multiplier: 2),
dateLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
fakeDateLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: leadingAnchor, multiplier: 2),
fakeDateLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
contentWarningLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: fakeDateLabel.trailingAnchor, multiplier: 2),
contentWarningLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
contentLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: centerXAnchor, multiplier: 1),
contentLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
separator.leadingAnchor.constraint(equalTo: leadingAnchor),
separator.trailingAnchor.constraint(equalTo: trailingAnchor),
separator.bottomAnchor.constraint(equalTo: bottomAnchor),
separator.heightAnchor.constraint(equalToConstant: 0.5),
heightAnchor.constraint(greaterThanOrEqualToConstant: 32),
])
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

View File

@ -0,0 +1,83 @@
//
// StatusTableRowCollectionViewCell.swift
// MastoSearchMobile
//
// Created by Shadowfacts on 7/3/22.
//
import UIKit
import MastoSearchCore
import SwiftSoup
class StatusTableRowCollectionViewCell: UICollectionViewCell {
// private static let formatter: DateFormatter = {
// let f = DateFormatter()
// f.locale = .current
// f.setLocalizedDateFormatFromTemplate("yyyy-MM-dd hh:mm a")
// return f
// }()
private static let dateStyle: Date.FormatStyle = {
Date.FormatStyle()
.year(.extended(minimumLength: 4))
.month(.twoDigits)
.day(.twoDigits)
.hour(.twoDigits(amPM: .abbreviated))
.minute(.twoDigits)
}()
private let dateLabel = UILabel()
private let contentWarningLabel = UILabel()
private let contentLabel = UILabel()
override init(frame: CGRect) {
super.init(frame: frame)
dateLabel.translatesAutoresizingMaskIntoConstraints = false
dateLabel.font = .monospacedDigitSystemFont(ofSize: 17, weight: .regular)
addSubview(dateLabel)
contentWarningLabel.translatesAutoresizingMaskIntoConstraints = false
addSubview(contentWarningLabel)
let spacer = UIView()
spacer.translatesAutoresizingMaskIntoConstraints = false
addSubview(spacer)
contentLabel.translatesAutoresizingMaskIntoConstraints = false
contentLabel.font = .preferredFont(forTextStyle: .callout)
contentLabel.numberOfLines = 2
addSubview(contentLabel)
NSLayoutConstraint.activate([
dateLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: leadingAnchor, multiplier: 2),
dateLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
contentWarningLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: dateLabel.trailingAnchor, multiplier: 2),
contentWarningLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
spacer.leadingAnchor.constraint(equalTo: contentWarningLabel.trailingAnchor),
centerXAnchor.constraint(equalToSystemSpacingAfter: spacer.trailingAnchor, multiplier: 1),
contentLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: centerXAnchor, multiplier: 1),
contentLabel.trailingAnchor.constraint(equalTo: trailingAnchor),
contentLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
contentLabel.topAnchor.constraint(greaterThanOrEqualTo: topAnchor, constant: 4),
bottomAnchor.constraint(greaterThanOrEqualTo: contentLabel.bottomAnchor, constant: 4),
heightAnchor.constraint(greaterThanOrEqualToConstant: 32),
])
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func updateUI(status: Status) {
dateLabel.text = status.published.formatted(StatusTableRowCollectionViewCell.dateStyle)
contentWarningLabel.text = status.summary ?? ""
let doc = try! SwiftSoup.parseBodyFragment(status.content)
contentLabel.text = try! doc.body()!.text()
}
}

View File

@ -0,0 +1,21 @@
//
// UIColor+App.swift
// MastoSearchMobile
//
// Created by Shadowfacts on 7/3/22.
//
import UIKit
extension UIColor {
static let alternatingTableRow = UIColor { traitCollection in
if traitCollection.userInterfaceStyle == .dark {
return .alternatingTableRowDark
} else {
return .alternatingTableRowLight
}
}
private static let alternatingTableRowDark = UIColor(white: 0.1, alpha: 1)
private static let alternatingTableRowLight = UIColor(white: 0.95, alpha: 1)
}

View File

@ -0,0 +1,214 @@
//
// ViewController.swift
// MastoSearchMobile
//
// Created by Shadowfacts on 7/3/22.
//
import UIKit
import MastoSearchCore
import Combine
import SafariServices
class ViewController: UIViewController {
private let searchQueue = DispatchQueue(label: "Search", qos: .userInitiated)
private var collectionView: UICollectionView!
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
private var searchQuerySubject = PassthroughSubject<String, Never>()
private var cancellables = Set<AnyCancellable>()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
navigationItem.title = "MastoSearch"
navigationItem.leadingItemGroups = [
UIBarButtonItemGroup(barButtonItems: [
UIBarButtonItem(title: "Account", menu: createAccountMenu()),
UIBarButtonItem(title: "Import", style: .plain, target: self, action: #selector(importPressed)),
], representativeItem: nil)
]
let searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
navigationItem.searchController = searchController
var config = UICollectionLayoutListConfiguration(appearance: .plain)
config.headerMode = .supplementary
config.itemSeparatorHandler = { indexPath, config in
if indexPath.row == 0 {
var config = config
config.topSeparatorVisibility = .hidden
return config
} else {
return config
}
}
let layout = UICollectionViewCompositionalLayout.list(using: config)
collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: layout)
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.allowsMultipleSelection = true
collectionView.delegate = self
view.addSubview(collectionView)
NSLayoutConstraint.activate([
collectionView.topAnchor.constraint(equalTo: view.topAnchor),
collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
])
let header = UICollectionView.SupplementaryRegistration<StatusTableHeaderView>(elementKind: UICollectionView.elementKindSectionHeader) { supplementaryView, elementKind, indexPath in
}
let cell = UICollectionView.CellRegistration<StatusTableRowCollectionViewCell, Status> { cell, indexPath, status in
cell.updateUI(status: status)
cell.backgroundColor = indexPath.row % 2 == 0 ? .alternatingTableRow : .systemBackground
}
dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { collectionView, indexPath, item in
collectionView.dequeueConfiguredReusableCell(using: cell, for: indexPath, item: item.status)
}
dataSource.supplementaryViewProvider = { collectionView, elementKind, indexPath in
guard elementKind == UICollectionView.elementKindSectionHeader else {
return nil
}
return collectionView.dequeueConfiguredReusableSupplementary(using: header, for: indexPath)
}
searchQuerySubject
.debounce(for: .milliseconds(100), scheduler: DispatchQueue.main)
.sink { [unowned self] query in
self.updateStatuses(query: query)
}
.store(in: &cancellables)
updateStatuses(query: "")
}
private func updateStatuses(query: String) {
searchQueue.async {
if query.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
DatabaseController.shared.getStatuses(sortDescriptor: NSSortDescriptor(key: "published", ascending: false)) { seq in
self.applyUpdate(statuses: seq)
}
} else {
DatabaseController.shared.getStatuses(query: query, sortDescriptor: NSSortDescriptor(key: "published", ascending: false)) { seq in
self.applyUpdate(statuses: seq)
}
}
}
}
private func applyUpdate(statuses: StatusSequence) {
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
snapshot.appendSections([.statuses])
snapshot.appendItems(statuses.map { Item(status: $0) })
DispatchQueue.main.async {
self.dataSource.apply(snapshot, animatingDifferences: false)
}
}
private func createAccountMenu() -> UIMenu {
if let account = LocalData.account {
return UIMenu(children: [
UIAction(title: "Logged in to \(account.instanceURL.host!)", attributes: .disabled, handler: { _ in }),
UIAction(title: "Log out", attributes: .destructive, handler: { [unowned self] _ in
self.logout()
}),
])
} else {
return UIMenu(children: [
UIAction(title: "Log in...", handler: { [unowned self] _ in
self.login()
}),
])
}
}
private func login() {
}
private func logout() {
}
@objc private func importPressed() {
}
}
extension ViewController {
enum Section {
case statuses
}
struct Item: Equatable, Hashable {
let status: Status
static func ==(lhs: Item, rhs: Item) -> Bool {
return lhs.status.url == rhs.status.url
}
func hash(into hasher: inout Hasher) {
hasher.combine(status.url)
}
}
}
extension ViewController: UISearchResultsUpdating {
func updateSearchResults(for searchController: UISearchController) {
searchQuerySubject.send(searchController.searchBar.text ?? "")
}
}
extension ViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let status = dataSource.itemIdentifier(for: indexPath)?.status else {
return
}
present(SFSafariViewController(url: URL(string: status.url)!), animated: true)
}
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemsAt indexPaths: [IndexPath], point: CGPoint) -> UIContextMenuConfiguration? {
let statuses = indexPaths.compactMap { dataSource.itemIdentifier(for: $0)?.status }
switch statuses.count {
case 0:
return nil
case 1:
let url = URL(string: statuses.first!.url)!
return UIContextMenuConfiguration {
SFSafariViewController(url: url)
} actionProvider: { _ in
UIMenu(children: [
UIAction(title: "Open in Safari", image: UIImage(systemName: "safari"), handler: { [unowned self] _ in
self.present(SFSafariViewController(url: url), animated: true)
}),
UIAction(title: "Copy URL", image: UIImage(systemName: "list.bullet.clipboard"), handler: { _ in
UIPasteboard.general.url = url
})
])
}
default:
return UIContextMenuConfiguration(actionProvider: { _ in
UIMenu(children: [
UIAction(title: "Copy URLs", image: UIImage(systemName: "list.bullet.clipboard"), handler: { _ in
UIPasteboard.general.urls = statuses.map { URL(string: $0.url)! }
})
])
})
}
}
func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
if let viewController = animator.previewViewController,
viewController is SFSafariViewController {
animator.preferredCommitStyle = .pop
animator.addCompletion {
self.present(viewController, animated: true)
}
}
}
}