mobilecreative.org
  • Home
  • Privacy Policy
  • Contact Us
  • Guest Post – Write For Us
  • Sitemap
mobilecreative.org

An extension to the standard SwiftUI library

  • James Gussie
  • September 9, 2021
Total
0
Shares
0
0
0

I have been working on a little library that is a natural extension to the SwiftUI library. It adds very few new features to SwiftUI but addresses 3 key shortcomings that I feel are worth addressing.

SwiftUI is an open-source project that aims to provide a flexible, scalable, and well-documented canvas to quickly get started with the iOS UI design workflow. SwiftUI features a common core that is easily extended with custom controls, but can also be used with any other UI components. Over the course of the last few months, several people in the community have contributed extensions to the core SwiftUI library in various ways, but none in the same way as the one I’d like to present in this blog post.

The idea of writing this post was actually inspired by some code I saw some time ago. The code was meant to integrate the SwiftUI library, which is a UIKit based library, with some custom code. There are several ways of integrating libraries with your code, but some people may not be aware that you can easily import UI elements into your Swift code, and that you do not need to write any extra code.

SwiftUIX aims to address the gaps in the SwiftUI framework, which is still in its infancy, by offering a comprehensive set of components, extensions, and utilities to supplement the standard library. This project is by far the most comprehensive transfer of missing UIKit/AppKit features, aiming for the most Apple-like implementation feasible.

The aim of this project is to provide hundreds of extensions and views to the SwiftUI standard library, allowing you, the developer, to create apps with the simplicity promised by SwiftUI’s revolution.

  • iOS 13, macOS 10.15, tvOS 13, or watchOS 6 are the latest versions of Apple’s operating system.
  • Swift 5.3 is the latest version.
  • Xcode 12.4+ is required.

The Swift Package Manager is the recommended method of installing SwiftUIX.

libSwiftPM is included into Xcode 11 to offer compatibility for the iOS, watchOS, macOS, and tvOS platforms.

  1. Open your project in Xcode and go to File Swift Packages. Dependency on a Package…
  2. Click Next after pasting the repository URL (https://github.com/SwiftUIX/SwiftUIX).
  3. Select Branch for Rules (with branch set to master).
  4. Finish by clicking the Finish button.
  5. Add SwiftUI.framework to the Linked Frameworks and Libraries and set Status to Optional in the Project settings.

The repository wiki has all documentation.

While the project is robust and widely used in production, the documentation is still in the works. Contributions are accepted and encouraged.

SwiftUI UIKit UIKit UIKit UIKit UIKit

UIKit SwiftUI SwiftUIX
LPLinkView – LinkPresentationView
UIActivityIndicatorView – ActivityIndicator
UIActivityViewController – AppActivityView
UIBlurEffect – BlurEffectView
UICollectionView – CollectionView
UIDeviceOrientation – DeviceLayoutOrientation
UIImagePickerController – ImagePicker
UIPageViewController – PaginationView
UIScreen – Screen
UISearchBar – SearchBar
UIScrollView ScrollView CocoaScrollView
UISwipeGestureRecognizer – SwipeGestureOverlay
UITableView List CocoaList
UITextField TextField CocoaTextField
UIModalPresentationStyle – ModalPresentationStyle
UIViewControllerTransitioningDelegate – UIHostingControllerTransitioningDelegate
UIVisualEffectView – VisualEffectView
UIWindow – WindowOverlay

Activity

  • ActivityIndicator

    ActivityIndicator() is a function that calculates how active a user is. true(animated) style(.large)

  • UIActivityViewController has a SwiftUI port called AppActivityView.

    AppActivityView(activityItems: […]) is a view of an app’s activities. excludeActivityTypes([…]) is a function that allows you to exclude certain types of activities. onCancel is a function that is called when a program is terminated. result in foo(result) onComplete

Appearance

  • View/visible(_:) – Controls the visibility of a view.

Handling Errors

  • TryButton – A button that can be used to conduct throwing actions.

Geometry

  • flip3D( :axis:reverse:) – This perspective is flipped.
  • RectangleCorner – A Rectangle’s corner.
  • ZeroSizeView – A zero-size view for when EmptyView isn’t sufficient.

Keyboard

  • The keyboard is represented by the object keyboard.
  • Pads this view with the active system height of the keyboard. View/padding(.keyboard)- Pads this view with the active system height of the keyboard.

Presentation of the Link:

Navigation

  • View/navigationBarColor(_:) – Sets the color of this view’s navigation bar.
  • View/navigationBarTranslucent(_:) – Sets the navigation bar’s translucency for this view.
  • View/navigation BarTransparent(_:) – Sets the navigation bar’s transparency for this view.
  • PaginationView

    PaginationView(axis: .horizontal) { ForEach(0..<10, id: .hashValue) { index in Text(String(index)) } } .currentPageIndex($…) .pageIndicatorAlignment(…) .pageIndicatorTintColor(…) .currentPageIndicatorTintColor(…)

Scrolling

  • View/isScrollEnabled(_:) – Adds a condition that determines whether or not users may scroll in this view. Works well with:

    • CocoaList
    • CocoaScrollView
    • CollectionView
    • TextView

    SwiftUI’s ScrollView does not function.

Search

  • UISearchBar is ported to SwiftUI as SearchBar.

    @State var isEditing: Bool = false @State var isEditing: Bool = false @State var isEditing: Bool = false @State var isEditing: Boo searchText: String = “” State var searchText: String = “” body variable: some SearchBar(“Search…”, text: $searchText, isEditing: $isEditing) is an example of a search bar. isEditing). showsCancelButton(isEditing). onCancel print(“Canceled!”) onCancel print(“Canceled!”) onCancel print(“Canceled!”) onCancel print(“Canceled!”

  • View/navigation Sets the navigation search bar for this view. SearchBar(_:)

    “Hello, world!” says the text. navigation SearchBar(“Placeholder”, text: $text) SearchBar(“Placeholder”, text: $text)

  • View/navigation When scrolling any underlying material, SearchBarHiddenWhenScrolling(_:) hides the integrated search bar.

Screen

  • Screen – An image of the device’s display.
  • UIUserInterfaceIdiom is ported to SwiftUI as UserInterfaceIdiom.
  • UserInterfaceOrientation – UserInterfaceOrientation in SwiftUI.

Scroll

  • ScrollIndicatorStyle – A type that defines how all scroll indicators in a view hierarchy look and interact.
    • A scroll indicator style that conceals all scroll view indicators inside a view hierarchy is HiddenScrollViewIndicatorStyle.

The Status Bar displays information about your current status.

  • View/statusItem(id:image:) – Adds a status bar item that, when clicked, displays a popover.

    “Hello, world!” says the text. image:.system(.exclamationmark)) statusItem(id: “foo”) statusItem(id: “foo”) statusItem(id: “foo”) statusItem(id: “f “Popover!” Text(“Popover!”) padding() is a function that is used to add padding to a

Text

Effects on the eye

Window

  • View/windowOverlay(isKeyAndVisible:content:) – Creates a window key that is visible when a condition is met.

@vmanot is the creator of SwiftUIX.

GitHub

https://github.com/SwiftUIX/SwiftUIX

SwiftUI (formerly known as SwiftyUI) is a collection of components that makes it easy to build modern mobile apps. It leverages the popularity of iOS8’s native UI elements, but provides a clean API for developers to work with. SwiftUI is focused on providing a consistent API for all the common user interface elements used in iOS8 apps, letting developers build apps that are both responsive and consistent.. Read more about awesome swiftui and let us know what you think.

Total
0
Shares
Share 0
Tweet 0
Pin it 0
James Gussie

Previous Article

Account was not set up on this device because device management could not be enabled

  • James Gussie
  • September 8, 2021
View Post
Next Article

How To Remove Malware From Android phone for free 2021

  • James Gussie
  • September 9, 2021
View Post
Table of Contents
    1. SwiftUI UIKit UIKit UIKit UIKit UIKit
    2. Activity
    3. Appearance
    4. Handling Errors
    5. Geometry
    6. Keyboard
    7. Presentation of the Link:
    8. Navigation
    9. Scrolling
    10. Search
    11. Screen
    12. Scroll
    13. The Status Bar displays information about your current status.
    14. Text
    15. Effects on the eye
    16. Window
  1. GitHub
Featured
  • 1
    10 Innovative Ways of Using Smartphone
    • June 7, 2022
  • 2
    Why does sample rate matter
    • April 14, 2022
  • 3
    How to Take Screenshot In Motorola Edge S30
    • December 24, 2021
  • 4
    How to fix the ‘something went wrong please try again’ error on Play Store?
    • December 23, 2021
  • 5
    How To Convert MBR To GPT For Windows 11 [2021]: 4 Best Ways
    • December 22, 2021
Must Read
  • 1
    Fix Windows 10 November 2021 update Version 21H2 Update problems
  • 2
    Download Candy Blast Mania for PC Windows 10,8,7
  • 3
    Download RealBucks TV for PC Windows 10,8,7
mobilecreative.org
  • Home
  • Privacy Policy
  • Contact Us
  • Guest Post – Write For Us
  • Sitemap
Stay Updated Always.

Input your search keywords and press Enter.