Skip to content

Commit

Permalink
Fixing public structs
Browse files Browse the repository at this point in the history
  • Loading branch information
joogps committed Nov 12, 2020
1 parent 861d3cb commit 75ddd77
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 27 deletions.
67 changes: 67 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/SlideOverCard.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SlideOverCard"
BuildableName = "SlideOverCard"
BlueprintName = "SlideOverCard"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SlideOverCard"
BuildableName = "SlideOverCard"
BlueprintName = "SlideOverCard"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
54 changes: 27 additions & 27 deletions Sources/SlideOverCard/SlideOverCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import SwiftUI

struct SlideOverCardView<Content:View>: View {
public struct SlideOverCardView<Content:View>: View {
@Binding var isPresented: Bool

var dragEnabled: Binding<Bool> = .constant(true)
Expand All @@ -18,7 +18,7 @@ struct SlideOverCardView<Content:View>: View {

@State private var viewOffset: CGFloat = 0.0

var body: some View {
public var body: some View {
VStack(alignment: .trailing, spacing: 0) {
if displayExitButton.wrappedValue {
Button(action: { isPresented = false }) {
Expand All @@ -45,63 +45,63 @@ struct SlideOverCardView<Content:View>: View {
}
}

struct SOCExitButton: View {
@Environment(\.colorScheme) var colorScheme

var body: some View {
ZStack {
Circle()
.fill(Color(white: colorScheme == .dark ? 0.19 : 0.93))
Image(systemName: "xmark")
.resizable()
.scaledToFit()
.font(Font.body.weight(.bold))
.scaleEffect(0.416)
.foregroundColor(Color(white: colorScheme == .dark ? 0.62 : 0.51))
}
}
}

protocol SOCButton: ButtonStyle {
var foregroundColor: Color { get }
var backgroundColor: Color { get }
}

extension SOCButton {
func makeBody(configuration: Configuration) -> some View {
public func makeBody(configuration: Configuration) -> some View {
HStack {
Spacer()
configuration.label
.font(Font.body.weight(.medium))
.padding(.vertical, 20)
.foregroundColor(foregroundColor)
Spacer()
}.background(backgroundColor).cornerRadius(12).overlay(configuration.isPressed ? Color.black.opacity(0.3) : nil)
}.background(backgroundColor).cornerRadius(12).overlay(configuration.isPressed ? Color.black.opacity(0.2) : nil)
}
}

struct SOCActionButton: SOCButton {
public struct SOCActionButton: SOCButton {
var foregroundColor: Color = .white
var backgroundColor: Color = .accentColor
}

struct SOCAlternativeButton: SOCButton {
public struct SOCAlternativeButton: SOCButton {
var foregroundColor: Color = .primary
var backgroundColor: Color = Color(.systemGray5)
}

struct SOCEmptyButton: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
public struct SOCEmptyButton: ButtonStyle {
public func makeBody(configuration: Configuration) -> some View {
configuration.label
.font(Font.body.weight(.bold))
.padding(.top, 20)
.padding(.top, 18)
.foregroundColor(.accentColor)
.opacity(configuration.isPressed ? 0.5 : 1)
}
}

public struct SOCExitButton: View {
@Environment(\.colorScheme) var colorScheme

public var body: some View {
ZStack {
Circle()
.fill(Color(white: colorScheme == .dark ? 0.19 : 0.93))
Image(systemName: "xmark")
.resizable()
.scaledToFit()
.font(Font.body.weight(.bold))
.scaleEffect(0.416)
.foregroundColor(Color(white: colorScheme == .dark ? 0.62 : 0.51))
}
}
}

extension View {
func slideOverCard<Content:View>(isPresented: Binding<Bool>, dragEnabled: Binding<Bool> = .constant(true), dragToDismiss: Binding<Bool> = .constant(true), displayExitButton: Binding<Bool> = .constant(true), @ViewBuilder content: @escaping () -> Content) -> some View {
public func slideOverCard<Content:View>(isPresented: Binding<Bool>, dragEnabled: Binding<Bool> = .constant(true), dragToDismiss: Binding<Bool> = .constant(true), displayExitButton: Binding<Bool> = .constant(true), @ViewBuilder content: @escaping () -> Content) -> some View {
ZStack {
self

Expand Down

0 comments on commit 75ddd77

Please sign in to comment.