EasySCADE
Create iOS and Android apps in SCADE using our EasySCADE Swift library
EasySCADE aims to simplify mobile app development by providing a set of utilities and wrappers that make it easier to work with the SCADE framework. This library is designed to streamline your development process, allowing you to focus more on building your app and less on boilerplate code.
Before you begin, ensure you have met the following requirements:
- macOS system.
- Swift 5.9 or later installed.
- SCADE SDK installed. Follow the installation guide at SCADE's GitHub repository.
Step 1: Install SCADE
Ensure you have SCADE installed on your system. You can find the installation instructions at https://github.com/scade-platform/SCADE.
Step 2: Add EasySCADE as a Dependency
Open your SCADE project's Package.swift
file and add EasySCADE to your project's dependencies:
import PackageDescription
import Foundation
let SCADE_SDK = ProcessInfo.processInfo.environment["SCADE_SDK"] ?? ""
let package = Package(
name: "YourProjectName",
platforms: [
.macOS(.v10_15),
.iOS(.v13)
],
products: [
.library(
name: "YourProjectName",
type: .static,
targets: [
"YourProjectName"
]
)
],
dependencies: [
// Add EasySCADE as a dependency
.package(url: "https://github.com/jblanked/EasySCADE", .branch("main"))
],
targets: [
.target(
name: "YourProjectName",
dependencies: ["EasySCADE"]),
exclude: ["main.page"],
swiftSettings: [
.unsafeFlags(["-F", SCADE_SDK], .when(platforms: [.macOS, .iOS])),
.unsafeFlags(["-I", "\(SCADE_SDK)/include"], .when(platforms: [.android])),
]
]
)
Replace YourProjectName
with your project name.
Step 3: Import EasySCADE
Now that you have added EasySCADE as a dependency, you can start using it in your project. Simply import EasySCADE in your Swift files:
import EasySCADE
Step 4: Start Using EasySCADE
You are now ready to simplify your SCADE app development with EasySCADE! Check the Usage section below for examples on how to use EasySCADE in your project.
let textLabel: SCDWidgetsContainer = EasySCDTextLabel("Your Text")
EasySCDTextLabel (
_ text: String,
fontsize:Int = 20,
font: String = "ArialMT",
fontcolor:SCDGraphicsRGB = EasyColor.black,
paddingVertical: Int = 0,
paddingHorizontal: Int = 10,
x_location: Int = 0,
y_location: Int = 0,
bold: Bool = false,
underline: Bool = false,
action: @escaping () -> Void = { },
alignment: SCDLayoutHorizontalAlignment = SCDLayoutHorizontalAlignment.left
) -> SCDWidgetsContainer
// subscription
@EasyTextPublisher var labelManager: EasySCDTextManager = EasySCDTextManager("Your-Text")
// get widget
let label: SCDWidgetsContainer = labelManager.label
// update text
labelManager.text = "New text"
// Open Combine
@SCDLabelPublisher let scdLabel: SCDLabelState = SCDWidgetsLabelCombine("Your-Text")
// get widget
let labelWidget: SCDWidgetsLabel = scdLabel.label
// update text
if let textLabel = scdLabel as? SCDWidgetsLabelCombine
{
textLabel.update("New Text")
}
let textBox: SCDWidgetsTextbox = EasySCDTextBox("Placeholder")
let textBoxForm: SCDWidgetsWidget = EasySCDTextForm (
[
EasySCDTextBoxForm(
title: "Your Title",
textbox: textBox // from above
)
]
)
EasySCDTextBox (
_ placeholder: String,
secure: Bool = false,
fontsize:Int = 20,
font: String = "ArialMT",
fontcolor:SCDGraphicsRGB = EasyColor.black,
width: Int = Int(screenInfo.screenSize.width) + 10,
paddingVertical: Int = 10,
paddingHorizontal: Int = 10,
location: SCDGraphicsPoint = SCDGraphicsPoint(x: 0, y: 0)
) -> SCDWidgetsTextbox
class EasySCDTextBoxForm {
var title: String
var textbox: SCDWidgetsTextbox
init (
title: String,
textbox: SCDWidgetsTextbox
) {
self.title = title
self.textbox = textbox
}
}
EasySCDTextForm (
_ forms: [EasySCDTextBoxForm],
fontsize:Int = 20,
font: String = "ArialMT",
fontcolor:SCDGraphicsRGB = EasyColor.black,
width: Int = Int(screenInfo.screenSize.width),
location: SCDGraphicsPoint = SCDGraphicsPoint(x: 0, y: 0)
) -> SCDWidgetsWidget
// EasyTextbox (UILabel for iOS - Best for Paragraphs)
let eBox: EasyTextbox = EasyTextbox("Type-Text-Here")
// remove from view
eBox.hide()
// add to view
eBox.show()
let web: SCDWidgetsWebView = EasySCDWebView("https://www.github.com/jblanked/EasySCADE")
EasySCDWebView(
_ url: String,
height: Int = Int(screenInfo.screenSize.width),
width: Int = Int(screenInfo.screenSize.width),
paddingVertical: Int = 0,
paddingHorizontal: Int = 10,
location: SCDGraphicsPoint = SCDGraphicsPoint(x: 0, y: 0)
) -> SCDWidgetsWebView
let checkBox: SCDWidgetsCheckbox = EasySCDCheckbox()
EasySCDCheckbox(
_ checked: Bool = false,
height: Int = 50,
location: SCDGraphicsPoint = SCDGraphicsPoint(x: Int(screenInfo.screenSize.width / 2.5), y: 0)
) -> SCDWidgetsCheckbox
let spacer: SCDWidgetsWidget = EasySCDSpacer()
EasySCDSpacer(_ height: Int = 20) -> SCDWidgetsWidget
let separator: SCDWidgetsWidget = EasySCDSeperator()
EasySCDSeparator(
_ y: Int = 20,
_ strokeColor: SCDSvgColor = EasySVGColor.black,
_ strokeWidth: Float = 1.0
) -> SCDWidgetsWidget
screenInfo.screenSize.height // Screen Height
screenInfo.screenSize.width // Screen Width
screenInfo.statusBarVisible // boolean
screenInfo.statusBarsize.height // Status Bar Height
screenInfo.statusBarsize.width // Status Bar Width
appStorage.write(key: "yourKey", value: "Your Value") // save value
appStorage.deleteAllKeys() // delete all keys
appStorage.delete(key: "yourKey") // delete key
if let yourValue = appStorage.read(key: "yourKey") // get value from key
{
print(yourValue)
}
let white: SCDGraphicsRGB = EasyColor.white
let black: SCDGraphicsRGB = EasyColor.black
let blue: SCDGraphicsRGB = EasyColor.blue
let red: SCDGraphicsRGB = EasyColor.red
EasyAlert(title:String, message:String,action: @escaping () -> Void = { })
EasySpinner(true) // show
EasySpinner(false) // hide
EasySwipeGesture(
self.page,
.left
)
image.swipeGesture({ self.navigation!.go(page: "main.page") }, .right)
let card: SCDWidgetsContainer = EasySCDCard(
path: "Assets/YourBackgroundImage.png",
title: "Header title",
description: "Body"
)
card.swipeGesture({ self.navigation!.go(page: "main.page") }, .left)
EasySCDCard (
path: String,
title: String,
description: String,
action: @escaping () -> Void = { }
) -> SCDWidgetsContainer
let list: SCDWidgetsContainer = EasySCDList(
[
EasySCDListElement(item: "Value1"),
EasySCDListElement(item: "Value2"),
EasySCDListElement(item: "Value3")
]
)
EasySCDList(_ list: [EasySCDListElement]) -> SCDWidgetsContainer
struct EasySCDListElement {
var item: String
var fontsize: Int
var fontcolor: SCDGraphicsRGB
var action: () -> Void
init(item: String, fontsize: Int = 15, fontcolor: SCDGraphicsRGB = EasyColor.black, action: @escaping () -> Void = {}) {
self.item = item
self.fontsize = fontsize
self.fontcolor = fontcolor
self.action = action
}
}
let vStack: SCDWidgetsContainer = EasySCDVStack(
[
textLabel, // from above
button // from above
]
)
EasySCDVStack(
_ elements: [SCDWidgetsWidget],
location: SCDGraphicsPoint = SCDGraphicsPoint(x: 0, y: Int(screenInfo.statusBarsize.height) + 15),
spacing: Int = 10
) -> SCDWidgetsContainer
// alternative VStack
self.vStack {
textLabel // from above
button // from above
}
// alternative VStack 2
let container: SCDWidgetsContainer = SCDWidgetsContainer()
container.vStack {
textLabel // from above
button // from above
}
let hStack: SCDWidgetsContainer = EasySCDHStack(
[
textLabel, // from above
button // from above
]
)
EasySCDHStack(
_ elements: [SCDWidgetsWidget],
location: SCDGraphicsPoint = SCDGraphicsPoint(x: 0, y: Int(screenInfo.statusBarsize.height) + 15),
spacing: Int = 10
) -> SCDWidgetsContainer
// alternative HStack
self.hStack {
textLabel // from above
button // from above
}
// alternative HStack 2
let container: SCDWidgetsContainer = SCDWidgetsContainer()
container.hStack {
textLabel // from above
button // from above
}
EasyTemplateLogin(self) // Login with Labels
EasyTemplateLogin(self,2) // Login without Labels
EasyTemplateLogin(self,3) // Login without Labels
// Login Class Init
init (
_ page: SCDLatticePageAdapter,
_ formNumber: Int = 1,
name: String = "easyTemplateSignIn",
backgroundColor: SCDGraphicsRGB = EasyColor.white
)
// Login Class Properties
var username: String
var password: String
var onClick: () -> Void
EasyTemplateRegistration(self) // Registration with Labels
EasyTemplateRegistration(self,2) // Registration without Labels
// Registration Class Init
init (
_ page: SCDLatticePageAdapter,
_ formNumber: Int = 1,
name: String = "easyTemplateRegistration",
backgroundColor: SCDGraphicsRGB = EasyColor.white
)
// Registration Class Properties
var username: String
var password: String
var password2: String
var firstName: String
var lastName: String
var email: String
var onClick: () -> Void