shaffex

MagicUI

Welcome to MagicUI, a revolutionary user interface framework designed with performance and flexibility in mind.

Ultra Lightweight

MagicUI is incredibly lightweight. We’ve stripped it down to the essentials, making it a perfect choice for projects where every kilobyte counts.

Blazing Fast Performance

Speed is at the heart of MagicUI. It’s optimized for high performance, ensuring your user interfaces are smooth and responsive, even under heavy load.

Plugin-Based Architecture

MagicUI is built on a plugin-based architecture. This means you can extend and customize it to suit your needs, adding only the features you need and keeping your project lean and efficient.

Experience the magic of user interface development with MagicUI!

Customised and Blazing Fast XML Parser

Our XML parser is a high-performance, customised solution designed to handle a wide range of XML documents. It’s engineered to be blazing fast, making it ideal for applications that require real-time processing of large XML files.

How to integrate Magic UI into your project

Step 1: Add Swift Package and import Magic UI framework

To start using Magic UI in your Swift project, the first step is to add Swift Package and import the MagicUiFramework. This framework provides all the necessary classes and methods to create and render dynamic UI components based on XML.

Add this Swift Package into your XCode project:

https://gitlab.com/magicui/magicui-framework-beta.git (will be updated)

Import MagicUiFramework into your SwiftUI file:

import MagicUiFramework

Step 2: Choose Your Data Source

Magic UI allows you to create views from various sources depending on where your XML data is stored. You can load the UI from a string, a local resource, a file, or a URL. Choose the method that best suits your use case.

Option 1: Initialize with a String

If your XML data is stored as a string, you can directly pass it to MagicUiView.

MagicUiView(string: "<body><text>Welcome to Magic UI!</text></body>")

Option 2: Initialize with a Resource

If your XML data is embedded within your app’s resources (e.g., within your Xcode project), you can reference it by name. The framework will look for the corresponding XML file in your bundle.

MagicUiView(resource: "MainScreen")

Note: Yor resource file must have an extension xml so it will be stored in your resources like MainScreen.xml

Option 3: Initialize with a File Path

You can also load an XML file from a specific path within the app’s file system. The root is app’s Documents folder

MagicUiView(file: "MYView.xml")

Option 4: Initialize with a URL

If your XML content is hosted remotely, you can load it directly from a URL. Magic UI will handle fetching and rendering the content.

MagicUiView(url: "https://example.com/myView.xml")

Step 3: There is No Step 3! It’s That Simple.

Once you’ve chosen and implemented your data source, Magic UI takes care of rendering the view for you. No additional steps are required. Your UI is now ready to be displayed with minimal setup.

Full Example: Rendering MagicUiView from a String

Here’s a complete example of how to render a Magic UI view from an XML string within a SwiftUI application:

import SwiftUI
import MagicUiFramework

struct ContentView: View {
    var body: some View {
        MagicUiView(string: "<body><text>Hello Magic UI!</text></body>")
    }
}

#Preview {
    ContentView()
}

Available Plugins

Views

Modifiers

Actions