Skip to content

Instantly share code, notes, and snippets.

Avatar

Jean-Marc Boullianne jboullianne

View GitHub Profile
@jboullianne
jboullianne / SlidingSheetModifier.swift
Created Sep 17, 2020
SwiftUI Custom Sliding Sheet
View SlidingSheetModifier.swift
//
// SheetBase.swift
// PopoverSheet_Tests
//
// Created by Jean-Marc Boullianne on 9/13/20.
// Copyright © 2020 TrailingClosure. All rights reserved.
//
import SwiftUI
@jboullianne
jboullianne / AlignmentControl.swift
Created Aug 28, 2020
Text Alignment Control made in SwiftUI
View AlignmentControl.swift
//
// AlignmentControl.swift
// MicroAnimations_Test
//
// Created by Jean-Marc Boullianne on 8/18/20.
//
import SwiftUI
struct AlignmentControl: View {
@jboullianne
jboullianne / ImageToggleStyle.swift
Created Aug 18, 2020
Custom SwiftUI ToggleStyle - Image Toggle
View ImageToggleStyle.swift
import SwiftUI
struct ImageToggleStyle: ToggleStyle {
var onImageName: String
var offImageName: String
func makeBody(configuration: Configuration) -> some View {
HStack {
configuration.label
@jboullianne
jboullianne / PowerToggleStyle.swift
Created Aug 18, 2020
Custom SwiftUI ToggleStyle - Power Button
View PowerToggleStyle.swift
import SwiftUI
struct PowerToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View {
HStack {
configuration.label
Spacer()
Rectangle()
.foregroundColor(configuration.isOn ? .green : .gray)
@jboullianne
jboullianne / CheckmarkToggleStyle.swift
Created Aug 18, 2020
Custom SwiftUI ToggleStyle - Checkmark
View CheckmarkToggleStyle.swift
import SwiftUI
struct CheckmarkToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View {
HStack {
configuration.label
Spacer()
Rectangle()
.foregroundColor(configuration.isOn ? .green : .gray)
View ScrollingHStackModifier_Example.swift
//
// ContentView.swift
// ScrollView_Tests
//
// Created by Jean-Marc Boullianne on 7/30/20.
//
import SwiftUI
struct ContentView: View {
@jboullianne
jboullianne / ScrollingHStackModifier.swift
Last active Sep 18, 2020
Implement Snap to Item scrolling in SwiftUI using this custom ViewModifier technique.
View ScrollingHStackModifier.swift
/
// ScrollingStackModifier.swift
// ScrollView_Tests
//
// Created by Jean-Marc Boullianne on 8/7/20.
//
import SwiftUI
struct ScrollingHStackModifier: ViewModifier {
View SideMenu_Example.swift
//
// SideMenuTest.swift
// CardEffectsTest
//
// Created by Jean-Marc Boullianne on 7/3/20.
//
import SwiftUI
struct SideMenuTest: View {
View SideMenu_New.swift
struct SideMenu: View {
@Binding var selected: Int
var options: [String]
var body: some View {
Text("Placeholder")
}
}
View SideMenu_Base.swift
import SwiftUI
struct SideMenu: View {
@Binding var selected: Int
var options: [String]
var body: some View {
HStack {
ForEach(options.indices) { i in
You can’t perform that action at this time.