Skip to content

✨📚🎸 More: DocC doc, Particle shader #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Documentation.docc/ScribbleLabTutorialContent.tutorial
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@Tutorials(name: "ScribbleLab") {
@Intro(title: "ScribbleLab Dev Intro") {
Get a slightly understanding what ScribbleLab is about and how our code works

@Image(source: <#file#>, alt: "<#accessible description#>")
}

@Chapter(name: "Exploring ScribbleLab's Code Base") {
In this Chapter you'll get a basic undertanding about our file structure and some basic Code Base. Furthermore you'll be teached how to contribute to ScribbleLab.

@Image(source: <#file#>, alt: "<#accessible description#>")

@TutorialReference(tutorial: "doc:Chapter1")
}
}
34 changes: 34 additions & 0 deletions Documentation.docc/tutorials/Chapter1.tutorial
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@Tutorial(time: 20) {
@Intro(title: "Chapter 1: Exploring ScribbleLab's Code Base") {
In this Chapter you'll get a basic undertanding about our file structure and some basic Code Base.

@Image(source: <#file#>, alt: "<#accessible description#>")
}

@Section(title: "ScribbleLab's folder structure") {
@ContentAndMedia {
ScribbleLab is a productive note-taking app that should make our Users lifes easier. Our note-taking app consists of a very large Code Base.

To easily maintain such a large Code Base for diffrent Plattforms it's crucial to have a well thought out file structure and documented code so that everyone can understand your & our written code.

> Important:
> Our project workspace contains the iOS/iPadOS and the macOS version of ScribbleLab. In this Tutorial we only discover the iOS Version of ScribbleLab.

@Image(source: <#file#>, alt: "<#accessible description#>")
}

@Steps {
@Step {
Open the navigator and open the ScribbleLab folder

@Image(source: <#file#>, alt: "<#accessible description#>")
}

@Step {
<#text#>

@Code(name: "<#display name#>", file: <#filename.swift#>)
}
}
}
}
20 changes: 20 additions & 0 deletions ScribbleLab.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
3836C2B92AF29CF5008F475F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 38AE9CA12AD0751100B761E8 /* Assets.xcassets */; };
3836C2BA2AF29CF8008F475F /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 385F788D2AD5C56E0096E504 /* Localizable.xcstrings */; };
3852D71A2B053C38007FAFF1 /* Shaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 3852D7192B053C38007FAFF1 /* Shaders.metal */; };
3852D71C2B054C11007FAFF1 /* OTP+2FAViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3852D71B2B054C11007FAFF1 /* OTP+2FAViewModel.swift */; };
3852D71F2B054D18007FAFF1 /* ParticleEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3852D71E2B054D18007FAFF1 /* ParticleEffect.swift */; };
3852D7212B054DBF007FAFF1 /* Particle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3852D7202B054DBF007FAFF1 /* Particle.swift */; };
3858A7782AD14C9E00FC6319 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3858A7772AD14C9E00FC6319 /* HomeView.swift */; };
3858A77B2AD14E9D00FC6319 /* TimetableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3858A77A2AD14E9D00FC6319 /* TimetableView.swift */; };
3858A77E2AD15E8900FC6319 /* NotificationSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3858A77D2AD15E8900FC6319 /* NotificationSheetView.swift */; };
Expand Down Expand Up @@ -241,6 +244,9 @@
3836C2AD2AF29CC1008F475F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3836C2AE2AF29CC1008F475F /* ScribbleLab_AppClip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ScribbleLab_AppClip.entitlements; sourceTree = "<group>"; };
3852D7192B053C38007FAFF1 /* Shaders.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Shaders.metal; sourceTree = "<group>"; };
3852D71B2B054C11007FAFF1 /* OTP+2FAViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OTP+2FAViewModel.swift"; sourceTree = "<group>"; };
3852D71E2B054D18007FAFF1 /* ParticleEffect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticleEffect.swift; sourceTree = "<group>"; };
3852D7202B054DBF007FAFF1 /* Particle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Particle.swift; sourceTree = "<group>"; };
3858A7772AD14C9E00FC6319 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
3858A77A2AD14E9D00FC6319 /* TimetableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimetableView.swift; sourceTree = "<group>"; };
3858A77D2AD15E8900FC6319 /* NotificationSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationSheetView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -454,6 +460,7 @@
38355ED52AD3D50F00392674 /* Componets */ = {
isa = PBXGroup;
children = (
3852D71D2B054D07007FAFF1 /* Effects */,
3852D7182B053C24007FAFF1 /* Shaders */,
38355ED62AD3D52D00392674 /* IGTextFieldModifier.swift */,
38355ED82AD3D71900392674 /* IGButtonModifier.swift */,
Expand Down Expand Up @@ -530,6 +537,15 @@
path = Shaders;
sourceTree = "<group>";
};
3852D71D2B054D07007FAFF1 /* Effects */ = {
isa = PBXGroup;
children = (
3852D71E2B054D18007FAFF1 /* ParticleEffect.swift */,
3852D7202B054DBF007FAFF1 /* Particle.swift */,
);
path = Effects;
sourceTree = "<group>";
};
3858A76B2AD1497300FC6319 /* App */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -877,6 +893,7 @@
38A5E9C62B03FDD10037C668 /* OTP+2FA Services */ = {
isa = PBXGroup;
children = (
3852D71B2B054C11007FAFF1 /* OTP+2FAViewModel.swift */,
);
path = "OTP+2FA Services";
sourceTree = "<group>";
Expand Down Expand Up @@ -1437,6 +1454,7 @@
buildActionMask = 2147483647;
files = (
3852D71A2B053C38007FAFF1 /* Shaders.metal in Sources */,
3852D7212B054DBF007FAFF1 /* Particle.swift in Sources */,
3858A77B2AD14E9D00FC6319 /* TimetableView.swift in Sources */,
3889688B2AF143C700F67F08 /* SettingsViewModel.swift in Sources */,
3858A77E2AD15E8900FC6319 /* NotificationSheetView.swift in Sources */,
Expand All @@ -1456,6 +1474,7 @@
38066B4F2AFE9F0E001A88D5 /* SLUpdateViewModel.swift in Sources */,
38A24C712AED15B600F81F07 /* ImageUploader.swift in Sources */,
38FFF9452AE3CA6F006719E2 /* Application_utility.swift in Sources */,
3852D71C2B054C11007FAFF1 /* OTP+2FAViewModel.swift in Sources */,
38D56F062AF59A0000CE3781 /* ImagePicker.swift in Sources */,
38A5E9BD2B03D7730037C668 /* OTPTextFieldView.swift in Sources */,
3868A3E02AD2E2F800D4CAEC /* SLLicenseView.swift in Sources */,
Expand Down Expand Up @@ -1489,6 +1508,7 @@
3868A3DE2AD2DBA300D4CAEC /* ImageView.swift in Sources */,
380D93972AE42C6600277D2D /* CompleteRegistartionView.swift in Sources */,
381E0B382ADC14E300A2A836 /* SLStudyPomodoroTimerView.swift in Sources */,
3852D71F2B054D18007FAFF1 /* ParticleEffect.swift in Sources */,
3868A3E62AD305B800D4CAEC /* CreateNewView.swift in Sources */,
38A5E9BB2B03D4E80037C668 /* SLOTP+2FAView.swift in Sources */,
3868A3DC2AD2DB0000D4CAEC /* ImageViewModel.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// OTP+2FAViewModel.swift
// ScribbleLab
//
// Created by Nevio Hirani on 15.11.23.
//

import Foundation

class OTP_2FAViewModel: ObservableObject {
@Published var otptext: String = ""
}
2 changes: 1 addition & 1 deletion ScribbleLab/Core/Auth/View/OTP+2FA/SLOTP+2FAView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct SLOTP_2FAView: View {
Button {

} label: {
Text("Next")
Text("Verify")
.modifier(IGButtonModifier())
}
}
Expand Down
27 changes: 27 additions & 0 deletions ScribbleLab/Core/Componets/Effects/Particle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Particle.swift
// ScribbleLab
//
// Created by Nevio Hirani on 15.11.23.
//

import SwiftUI

/// Particle model
struct Particle: Identifiable {
var id: UUID = .init()

var randomX: CGFloat = 0
var randomY: CGFloat = 0
var scale: CGFloat = 1

var opacity: CGFloat = 1

/// Reset all properties
mutating func reset() {
randomX = 0
randomY = 0
scale = 1
opacity = 1
}
}
58 changes: 58 additions & 0 deletions ScribbleLab/Core/Componets/Effects/ParticleEffect.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// ParticleEffect.swift
// ScribbleLab
//
// Created by Nevio Hirani on 15.11.23.
//

import SwiftUI

/// Custom View Modifier
extension View {
@ViewBuilder
func particleEffect(systemImage: String, font: Font, status: Bool, activeTint: Color, inActiveTint: Color) -> some View {
self
.modifier(
ParticleModifier(systemImage: systemImage, font: font, status: status, activeTint: activeTint, inActiveTint: inActiveTint)
)
}
}

fileprivate struct ParticleModifier: ViewModifier {
var systemImage: String
var font: Font
var status: Bool
var activeTint: Color
var inActiveTint: Color

/// View Properties
@State private var particles: [Particle] = []

func body(content: Content) -> some View {
content
.overlay(alignment: .top) {
ZStack {
ForEach(particles) { particle in
Image(systemName: systemImage)
.foregroundStyle(status ? activeTint : inActiveTint)
.scaleEffect(particle.scale)
.offset(x: particle.randomX, y: particle.randomY)
.opacity(particle.opacity)
.opacity(status ? 1 : 0)

/// Making base visibility with zero animation
.animation(.none, value: status)
}
}
.onAppear {
/// Adding base particles for animation
if particles.isEmpty {
for _ in 1...15 {
let particle = Particle()
particles.append(particle)
}
}
}
}
}
}