- Open your Xcode project.
- Go to File > Add Packages.
- Enter the repository URL for Nebula:
https://github.com/your-repo/Nebula.git. - Choose the version or branch you want to use.
- Click Add Package to integrate it into your project.
After adding the package, you can import Nebula into your Swift files:
import NebulaYou're now ready to use Nebula in your project!
Here are some examples of components available in Nebula:
import Nebula
struct ContentView: View {
var body: some View {
PrimaryButton(title: "Click Me", size: .large, action: {
print("Primary button tapped!")
})
}
}
```
#### Example 2: Using the `SecondaryButton`
```swift
import Nebula
struct ContentView: View {
var body: some View {
SecondaryButton(
title: "Cancel",
action: {
print("Secondary button tapped!")
},
size: .medium,
buttonType: .warning
)
.borderWidth(2)
}
}
```
#### Example 3: Using `ColorToken`
```swift
import Nebula
struct ColorExampleView: View {
var body: some View {
Text("Styled Text")
.colorToken(.labelDefault)
.padding()
.background(ColorToken.backgroundDefault.color)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(ColorToken.borderDefault.color, lineWidth: 1)
)
}
}
```
#### Example 4: Using `Typography`
```swift
import Nebula
struct TypographyExampleView: View {
var body: some View {
VStack(alignment: .leading, spacing: Spacing.medium) {
Text("Title Large").typography(.titleLarge)
Text("Title Regular").typography(.titleRegular)
Text("Body Medium").typography(.bodyMedium)
Text("Caption Regular").typography(.captionRegular)
}
}
}
```
#### Example 5: Using `MSAInputField`
```swift
import Nebula
struct InputFieldExample: View {
@State private var email = ""
@State private var password = ""
var body: some View {
VStack(spacing: Spacing.large) {
MSAInputField(
text: $email,
placeholder: "Email address",
inputType: .email
)
MSAInputField(
text: $password,
placeholder: "Password",
inputType: .password
)
}
.padding()
}
}
```
#### Example 6: Using `NebulaIllustration`
```swift
import Nebula
struct IllustrationExample: View {
var body: some View {
VStack {
NebulaIllustration.businessDeal.image
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 200)
Text("Business Deal Illustration")
.typography(.subtitle)
}
}
}