-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,762 additions
and
1 deletion.
There are no files selected for viewing
496 changes: 496 additions & 0 deletions
496
AxisTooltipExample/AxisTooltipExample.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
AxisTooltipExample/AxisTooltipExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...le/AxisTooltipExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
11 changes: 11 additions & 0 deletions
11
AxisTooltipExample/Shared/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
148 changes: 148 additions & 0 deletions
148
AxisTooltipExample/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "83.5x83.5" | ||
}, | ||
{ | ||
"idiom" : "ios-marketing", | ||
"scale" : "1x", | ||
"size" : "1024x1024" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "512x512" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "512x512" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// AxisTooltipExampleApp.swift | ||
// AxisTooltipExample | ||
// | ||
// Created by jasu on 2022/02/27. | ||
// Copyright (c) 2022 jasu All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
@main | ||
struct AxisTooltipExampleApp: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
ContentView() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
// | ||
// ContentView.swift | ||
// AxisTooltipExample | ||
// | ||
// Created by jasu on 2022/02/27. | ||
// Copyright (c) 2022 jasu All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import AxisTooltip | ||
|
||
struct ContentView: View { | ||
|
||
@State private var isPresented: Bool = true | ||
@State private var constant: ATConstant = .init(border: ATBorderConstant(color: .pink)) | ||
|
||
let alignments: [Alignment] = [.center, .leading, .trailing, .top, .bottom, .topLeading, .topTrailing, .bottomLeading, .bottomTrailing] | ||
@State private var alignmentIndex: Int = 0 | ||
|
||
var body: some View { | ||
|
||
NavigationView { | ||
NavigationLink("Show") { | ||
VStack { | ||
ZStack { | ||
Text("AxisTooltip") | ||
.bold() | ||
.padding() | ||
.background(Color.pink) | ||
.cornerRadius(10) | ||
.onTapGesture { | ||
isPresented.toggle() | ||
} | ||
.axisToolTip(isPresented: $isPresented, alignment: alignments[alignmentIndex], constant: constant, foreground: { | ||
Label("Contrary to popular belief, Lorem Ipsum is not simply random text.", systemImage: "heart") | ||
.padding() | ||
.frame(width: 200) | ||
}) | ||
} | ||
.background(Color.blue.opacity(0.2)) | ||
Spacer() | ||
VStack { | ||
VStack(alignment: .leading, spacing: 5) { | ||
Text("● Border").foregroundColor(Color.accentColor).opacity(0.5) | ||
HStack { | ||
HStack { | ||
Text(" color :").opacity(0.5) | ||
ColorPicker("", selection: $constant.border.color).labelsHidden() | ||
} | ||
Divider().frame(maxHeight: 40) | ||
HStack { | ||
Text(" style :").opacity(0.5) | ||
Button { | ||
if constant.border.style == nil { | ||
constant.border.style = StrokeStyle(lineWidth: 2, dash: [5]) | ||
}else { | ||
constant.border.style = nil | ||
} | ||
} label: { | ||
Text(constant.border.style == nil ? "Off" : "On") | ||
.padding(7) | ||
.background(constant.border.style == nil ? Color.gray.opacity(0.2) : Color.accentColor) | ||
.cornerRadius(8) | ||
} | ||
.buttonStyle((PlainButtonStyle())) | ||
} | ||
} | ||
HStack { | ||
Text(" radius :").opacity(0.5) | ||
Slider(value: $constant.border.radius, in: 0...26) | ||
Text("\(constant.border.radius, specifier: "%.2f")") | ||
} | ||
HStack { | ||
Text(" lineWidth :").opacity(0.5) | ||
Slider(value: $constant.border.lineWidth, in: 0...26) | ||
Text("\(constant.border.lineWidth, specifier: "%.2f")") | ||
} | ||
.disabled(constant.border.style != nil) | ||
.opacity(constant.border.style != nil ? 0.5 : 1) | ||
} | ||
|
||
VStack(alignment: .leading, spacing: 5) { | ||
Text("● Arrow").foregroundColor(Color.accentColor).opacity(0.5) | ||
HStack { | ||
VStack { | ||
HStack { | ||
Text(" width : ").opacity(0.5) | ||
Spacer() | ||
Text("\(constant.arrow.width, specifier: "%.2f")") | ||
} | ||
Slider(value: $constant.arrow.width, in: 0...26) | ||
} | ||
Divider().frame(maxHeight: 40) | ||
VStack { | ||
HStack { | ||
Text(" height : ").opacity(0.5) | ||
Spacer() | ||
Text("\(constant.arrow.height, specifier: "%.2f")") | ||
} | ||
Slider(value: $constant.arrow.height, in: 0...26) | ||
} | ||
} | ||
} | ||
VStack(alignment: .leading, spacing: 5) { | ||
Text("● distance").foregroundColor(Color.accentColor).opacity(0.5) | ||
HStack { | ||
Slider(value: $constant.distance, in: 0...26) | ||
Text("\(constant.distance, specifier: "%.2f")") | ||
} | ||
} | ||
VStack(alignment: .leading, spacing: 5) { | ||
Text("● AxisMode").foregroundColor(Color.accentColor).opacity(0.5) | ||
HStack { | ||
Picker("", selection: $constant.axisMode) { | ||
Text("Top").tag(ATAxisMode.top) | ||
Text("Bottom").tag(ATAxisMode.bottom) | ||
Text("Leading").tag(ATAxisMode.leading) | ||
Text("Trailing").tag(ATAxisMode.trailing) | ||
} | ||
.pickerStyle(SegmentedPickerStyle()) | ||
Toggle("", isOn: $isPresented).labelsHidden() | ||
} | ||
} | ||
Picker("", selection: $alignmentIndex) { | ||
ForEach(Array(alignments.enumerated()), id:\.offset) { index, align in | ||
Image(systemName: getAlignmentIcon(alignments[index])).tag(index) | ||
} | ||
} | ||
.pickerStyle(SegmentedPickerStyle()) | ||
} | ||
.zIndex(-1) | ||
} | ||
.font(.callout) | ||
.animation(.easeInOut, value: constant) | ||
.animation(.easeInOut, value: alignmentIndex) | ||
.padding() | ||
.navigationBarTitleDisplayMode(.inline) | ||
} | ||
} | ||
} | ||
|
||
private func getAlignmentIcon(_ alignment: Alignment) -> String { | ||
switch alignment { | ||
case .center: return "rectangle.center.inset.filled" | ||
case .leading: return "rectangle.leftthird.inset.filled" | ||
case .trailing: return "rectangle.rightthird.inset.filled" | ||
case .top: return "rectangle.topthird.inset.filled" | ||
case .bottom: return "rectangle.bottomthird.inset.filled" | ||
case .topLeading: return "rectangle.inset.topleft.filled" | ||
case .topTrailing: return "rectangle.inset.topright.filled" | ||
case .bottomLeading: return "rectangle.inset.bottomleft.filled" | ||
case .bottomTrailing: return "rectangle.inset.bottomright.filled" | ||
default: | ||
return "" | ||
} | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView().preferredColorScheme(.dark) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.app-sandbox</key> | ||
<true/> | ||
<key>com.apple.security.files.user-selected.read-only</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.