diff --git a/DemoApp/DemoApp/BaseView.swift b/DemoApp/DemoApp/BaseView.swift index 57d8b21..bebbdc4 100644 --- a/DemoApp/DemoApp/BaseView.swift +++ b/DemoApp/DemoApp/BaseView.swift @@ -34,7 +34,12 @@ struct BaseView: View { } struct BaseView_Previews: PreviewProvider { + static let neumorphism = NeumorphismManager( + lightColor: Color(hex: "C1D2EB"), + darkColor: Color(hex: "2C292C") + ) static var previews: some View { BaseView() + .environmentObject(neumorphism ) } } diff --git a/NeumorphismUI.xcodeproj/project.pbxproj b/NeumorphismUI.xcodeproj/project.pbxproj index 41b5df9..3adb06e 100644 --- a/NeumorphismUI.xcodeproj/project.pbxproj +++ b/NeumorphismUI.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + AA5875A325263BD40015AF11 /* NeumorphismContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA5875A225263BD40015AF11 /* NeumorphismContent.swift */; }; DA14F56F2458DEFF008BCD97 /* NeumorphismConcaveModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA14F56E2458DEFF008BCD97 /* NeumorphismConcaveModifier.swift */; }; DA5AFAC9241691210098E0BB /* NeumorphismButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5AFAC8241691210098E0BB /* NeumorphismButton.swift */; }; DA5AFACD2418332A0098E0BB /* ShapeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5AFACC2418332A0098E0BB /* ShapeType.swift */; }; @@ -62,6 +63,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + AA5875A225263BD40015AF11 /* NeumorphismContent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NeumorphismContent.swift; sourceTree = ""; }; DA14F56E2458DEFF008BCD97 /* NeumorphismConcaveModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeumorphismConcaveModifier.swift; sourceTree = ""; }; DA1A6B5F240B76D9001EA5EB /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; DA5AFAC8241691210098E0BB /* NeumorphismButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeumorphismButton.swift; sourceTree = ""; }; @@ -203,6 +205,7 @@ DA954C772411D9740052B8FF /* NeumorphismManager.swift */, DA5AFACE241833430098E0BB /* AnyShape.swift */, DA5AFACC2418332A0098E0BB /* ShapeType.swift */, + AA5875A225263BD40015AF11 /* NeumorphismContent.swift */, DA987319240BDE580083EB5E /* CustomViews */, OBJ_10 /* Extensions */, DA5AFAD0241834A70098E0BB /* Modifier */, @@ -304,6 +307,7 @@ DA954C782411D9740052B8FF /* NeumorphismManager.swift in Sources */, DA5AFAC9241691210098E0BB /* NeumorphismButton.swift in Sources */, DAD9549B241BCFBE00D3F56E /* NeumorphismBindingButton.swift in Sources */, + AA5875A325263BD40015AF11 /* NeumorphismContent.swift in Sources */, DA5AFACD2418332A0098E0BB /* ShapeType.swift in Sources */, OBJ_32 /* ViewExtension.swift in Sources */, DAD95499241BBD7500D3F56E /* NeumorphismCircleDentView.swift in Sources */, diff --git a/Sources/NeumorphismContent.swift b/Sources/NeumorphismContent.swift new file mode 100644 index 0000000..becee43 --- /dev/null +++ b/Sources/NeumorphismContent.swift @@ -0,0 +1,39 @@ +import SwiftUI + +@available(iOS 14.0, *) +public struct NeumorphismContent: LibraryContentProvider { + @LibraryContentBuilder + public var views: [LibraryItem] { + LibraryItem( + NeumorphismDentView(shapeType: .rectangle, width: 300, height: 4, color: nil, cornerRadius: 4), + title: "Neumorphism Dent View", + category: .control + ) + LibraryItem( + NeumorphismButton(shapeType: .circle, normalImage: Image(systemName: "star"), selectedImage: Image(systemName: "star.fill"), width: 100, height: 100, imageWidth: 44, imageHeight: 44, color: nil, shadowRadius: 8, handler: nil), + title: "Neumorphism Simple Button sample", + category: .control + ) + } + + @LibraryContentBuilder + public func modifiers(base: AnyView) -> [LibraryItem] { + LibraryItem( + base.neumorphismShadow(), + title: "Neumorphism Simple shadow", + category: .effect + ) + LibraryItem( + base.neumorphismShadow( + baseColor: nil, + radius: 8, + x: 4, + y: 4, + isAnimation: true + ), + title: "Neumorphism Custom shadow", + category: .effect + ) + } +} +