Swift is a compiled, strongly-typed language. The compiler uses type inference to identify the type of an object, or you can explicitly use type annotation.
var favoritePeanut = "Charlie Brown" // String
import { prefixStorage } from "unstorage"; | |
import type { Storage } from "unstorage"; | |
type Session = { | |
id: string | |
userId: string | |
expiredAt: Date | |
} | |
extension UIHostingController { | |
convenience public init(rootView: Content, ignoreSafeArea: Bool) { | |
self.init(rootView: rootView) | |
if ignoreSafeArea { | |
disableSafeArea() | |
} | |
} | |
func disableSafeArea() { |
import SwiftUI | |
struct PageView<Page: View>: UIViewControllerRepresentable { | |
var pages: [Page] | |
@Binding var currentPage: Int | |
func makeUIViewController(context: Context) -> UIPageViewController { | |
let pageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal) | |
// | |
// ContentView.swift | |
// | |
// Created by Chris Eidhof on 20.04.20. | |
// Copyright © 2020 objc.io. All rights reserved. | |
// | |
import SwiftUI | |
import UIKit |
// accessing the window and changing the root view controller property | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// getting access to the window object from SceneDelegate | |
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, | |
let sceneDelegate = windowScene.delegate as? SceneDelegate | |
else { | |
return | |
} | |
let viewcontroller = UIViewController() |
import SwiftUI | |
import UIKit | |
struct PageViewController: UIViewControllerRepresentable { | |
var controllers: [UIViewController] | |
@Binding var currentPage: Int | |
func makeCoordinator() -> Coordinator { | |
Coordinator(self) | |
} |
import UIKit | |
class InstaStories: NSObject { | |
private let urlScheme = URL(string: "instagram-stories://share")! | |
enum optionsKey: String { | |
case StickerImage = "com.instagram.sharedSticker.stickerImage" | |
case bgImage = "com.instagram.sharedSticker.backgroundImage" | |
case bgVideo = "com.instagram.sharedSticker.backgroundVideo" |