Set up a directory with project.clj below.
Create namespaces in src/clj/server/core.clj and src/cljs/client/core.cljs
Create an index.html as below in resource/public/.
Start two REPLs with ' " (jack-in-cljs)
Then in CLJS repl:
| // Basic idea from https://swiftui-lab.com/communicating-with-the-view-tree-part-1/ | |
| import SwiftUI | |
| // --- Provides support for a child to propogate its frame | |
| struct ChildPreferenceData: Equatable { | |
| let idx: Int | |
| let bounds: CGRect | |
| } |
| /// The ring leader | |
| final class ModalTransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate { | |
| func presentationController( | |
| forPresented presented: UIViewController, | |
| presenting: UIViewController?, | |
| source: UIViewController | |
| ) -> UIPresentationController? { | |
| return PresentationController(presentedViewController: presented, presenting: presenting) | |
| } |
Set up a directory with project.clj below.
Create namespaces in src/clj/server/core.clj and src/cljs/client/core.cljs
Create an index.html as below in resource/public/.
Start two REPLs with ' " (jack-in-cljs)
Then in CLJS repl:
| ;; -*- mode: emacs-lisp -*- | |
| ;; This file is loaded by Spacemacs at startup. | |
| ;; It must be stored in your home directory. | |
| (defun dotspacemacs/layers () | |
| "Configuration Layers declaration. | |
| You should not put any user code in this function besides modifying the variable | |
| values." | |
| (setq-default | |
| ;; Base distribution to use. This is a layer contained in the directory |
| ;; -*- mode: emacs-lisp -*- | |
| ;; This file is loaded by Spacemacs at startup. | |
| ;; It must be stored in your home directory. | |
| (defun dotspacemacs/layers () | |
| "Configuration Layers declaration. | |
| You should not put any user code in this function besides modifying the variable | |
| values." | |
| (setq-default | |
| ;; Base distribution to use. This is a layer contained in the directory |
| border: no | |
| license: mit | |
| height: 650 |
| border: no | |
| license: mit | |
| height: 640 |
| border: no | |
| license: gpl-3.0 |
| module Main where | |
| import Control.Monad | |
| import Data.Char (toLower) | |
| import Data.Maybe (isJust, isNothing, fromMaybe) | |
| import Data.List (intersperse) | |
| import System.Exit (exitSuccess) | |
| import System.Random (randomRIO) | |
| data Puzzle = Puzzle String [Maybe Char] String |
| // This shows a bug in Swift 2.2 (and 2.3) where `self` gets released in a recursive call | |
| extension Dictionary { | |
| mutating func append(_ other: [String: AnyObject]) { | |
| // 2. After the call 1. below, `other` would have been dealloced in the recursive call :( | |
| for (key, value) in other { | |
| if let otherSubDict = value as? [String: AnyObject], | |
| var selfSubDict = self[key] as? AnyObject as? [String: AnyObject] | |
| { | |
| // 1. Make a recursive call |