Skip to content

Instantly share code, notes, and snippets.

View evarilci's full-sized avatar
💢
ouch

Eymen Varilci evarilci

💢
ouch
View GitHub Profile
@evarilci
evarilci / Bouncing ball.swift
Created February 25, 2025 08:58
Bouncing ball within the rotating hexagon in Swift and UIKit. It has been created by o3-mini and fine tuned by me.
import UIKit
class ViewController: UIViewController {
// The view that draws the hexagon outline.
let hexagonView = HexagonView()
// The ball view.
let ballView = UIView(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
extension UIViewController {
func showBottomSheet(_ bottomSheet: UIViewController) {
if #available(iOS 16.0, *) {
if let sheetPresentationController = bottomSheet.presentationController as? UISheetPresentationController {
sheetPresentationController.detents = [.custom(resolver: {context in
250})]
sheetPresentationController.prefersGrabberVisible = true
}