Skip to content

Commit

Permalink
add LibraryItem
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzukihashi committed Oct 1, 2020
1 parent 1c4ff6f commit e6d8d6c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions DemoApp/DemoApp/BaseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
}
}
4 changes: 4 additions & 0 deletions NeumorphismUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -62,6 +63,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
AA5875A225263BD40015AF11 /* NeumorphismContent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NeumorphismContent.swift; sourceTree = "<group>"; };
DA14F56E2458DEFF008BCD97 /* NeumorphismConcaveModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeumorphismConcaveModifier.swift; sourceTree = "<group>"; };
DA1A6B5F240B76D9001EA5EB /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
DA5AFAC8241691210098E0BB /* NeumorphismButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeumorphismButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -203,6 +205,7 @@
DA954C772411D9740052B8FF /* NeumorphismManager.swift */,
DA5AFACE241833430098E0BB /* AnyShape.swift */,
DA5AFACC2418332A0098E0BB /* ShapeType.swift */,
AA5875A225263BD40015AF11 /* NeumorphismContent.swift */,
DA987319240BDE580083EB5E /* CustomViews */,
OBJ_10 /* Extensions */,
DA5AFAD0241834A70098E0BB /* Modifier */,
Expand Down Expand Up @@ -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 */,
Expand Down
39 changes: 39 additions & 0 deletions Sources/NeumorphismContent.swift
Original file line number Diff line number Diff line change
@@ -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
)
}
}

0 comments on commit e6d8d6c

Please sign in to comment.