Created
October 19, 2020 10:14
-
-
Save SteveMarshall/59810e483c74e84c7bcdb5fcfcad94e7 to your computer and use it in GitHub Desktop.
CoreSpotlight thumbnails not shown on devices running iOS 14.0 (Regression from iOS 13.6) testcase
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
import UIKit | |
@main | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
return true | |
} | |
// MARK: UISceneSession Lifecycle | |
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { | |
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | |
} | |
} | |
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
import CoreSpotlight | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
Text("Hello, UIKit!") | |
.onAppear(perform: { | |
let attributeSet = CSSearchableItemAttributeSet(itemContentType: "public.content") | |
attributeSet.displayName = "Hello UIKit?" | |
attributeSet.thumbnailData = UIImage(systemName: "hand.thumbsup.fill")?.pngData() | |
let item = CSSearchableItem(uniqueIdentifier: "uikit.shelloworld", domainIdentifier: nil, attributeSet: attributeSet) | |
CSSearchableIndex.default().indexSearchableItems([item]) { (error) in | |
print(error as Any) | |
} | |
}) | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
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
<?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>CFBundleDevelopmentRegion</key> | |
<string>$(DEVELOPMENT_LANGUAGE)</string> | |
<key>CFBundleExecutable</key> | |
<string>$(EXECUTABLE_NAME)</string> | |
<key>CFBundleIdentifier</key> | |
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | |
<key>CFBundleInfoDictionaryVersion</key> | |
<string>6.0</string> | |
<key>CFBundleName</key> | |
<string>$(PRODUCT_NAME)</string> | |
<key>CFBundlePackageType</key> | |
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | |
<key>CFBundleShortVersionString</key> | |
<string>1.0</string> | |
<key>CFBundleVersion</key> | |
<string>1</string> | |
<key>LSRequiresIPhoneOS</key> | |
<true/> | |
<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> | |
<key>UIApplicationSupportsIndirectInputEvents</key> | |
<true/> | |
<key>UILaunchStoryboardName</key> | |
<string>LaunchScreen</string> | |
<key>UIRequiredDeviceCapabilities</key> | |
<array> | |
<string>armv7</string> | |
</array> | |
<key>UISupportedInterfaceOrientations</key> | |
<array> | |
<string>UIInterfaceOrientationPortrait</string> | |
<string>UIInterfaceOrientationLandscapeLeft</string> | |
<string>UIInterfaceOrientationLandscapeRight</string> | |
</array> | |
<key>UISupportedInterfaceOrientations~ipad</key> | |
<array> | |
<string>UIInterfaceOrientationPortrait</string> | |
<string>UIInterfaceOrientationPortraitUpsideDown</string> | |
<string>UIInterfaceOrientationLandscapeLeft</string> | |
<string>UIInterfaceOrientationLandscapeRight</string> | |
</array> | |
</dict> | |
</plist> |
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
import UIKit | |
import SwiftUI | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
let contentView = ContentView() | |
if let windowScene = scene as? UIWindowScene { | |
let window = UIWindow(windowScene: windowScene) | |
window.rootViewController = UIHostingController(rootView: contentView) | |
self.window = window | |
window.makeKeyAndVisible() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment