HexagonParamaters.swift
//
// HexagonParameters.swift
// Landmarks
//
// Created by Besleaga Alexandru Marian on 5/11/21.
//
import Foundation
import CoreGraphics
struct HexagonParamaters{
struct Segment {
let line: CGPoint
let curve: CGPoint
let control: CGPoint
}
static let adjustment: CGFloat = 0.085
static let segments = [
Segment(
line: CGPoint(x: 0.60, y: 0.05),
curve: CGPoint(x: 0.40, y: 0.05),
control: CGPoint(x: 0.50, y: 0.00)
),
Segment(
line: CGPoint(x: 0.05, y: 0.20),
curve: CGPoint(x: 0.00, y: 0.30),
control: CGPoint(x: 0.00, y: 0.25)
),
Segment(
line: CGPoint(x: 0.00, y: 0.70),
curve: CGPoint(x: 0.05, y: 0.80),
control: CGPoint(x: 0.00, y: 0.75)
),
Segment(
line: CGPoint(x: 0.40, y: 0.95),
curve: CGPoint(x: 0.60, y: 0.95),
control: CGPoint(x: 0.50, y: 1.00)
),
Segment(
line: CGPoint(x: 0.95, y: 0.80),
curve: CGPoint(x: 1.00, y: 0.70),
control: CGPoint(x: 1.00, y: 0.75)
),
Segment(
line: CGPoint(x: 1.00, y: 0.30),
curve: CGPoint(x: 0.95, y: 0.20),
control: CGPoint(x: 1.00, y: 0.25)
)
]
}
BadgeBackground.swift
//
// BadgeBackground.swift
// Landmarks
//
// Created by Besleaga Alexandru Marian on 5/11/21.
//
import SwiftUI
struct BadgeBackground: View {
var body: some View {
Path { path in
var width: CGFloat = 100.0
let height = width
path.move(
to: CGPoint(
x: width * 0.95,
y: height * (0.20 + HexagonParameters.adjustment)
)
)
HexagonParameters.segments.forEach { segment in
path.addLine(
to: CGPoint(
x: width * segment.line.x,
y: height * segment.line.y
)
)
path.addQuadCurve(
to: CGPoint(
x: width * segment.curve.x,
y: height * segment.curve.y
),
control: CGPoint(
x: width * segment.control.x,
y: height * segment.control.y
)
)
}
}
.fill(Color.black)
}
}
struct BadgeBackground_Previews: PreviewProvider {
static var previews: some View {
BadgeBackground()
}
}
Cannot find 'HexagonParameters' in scope
What should I do ?