Skip to content

Commit

Permalink
Some smallish fixes to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
hacklschorsch committed Jun 6, 2024
1 parent 227e778 commit 0b601fd
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,40 @@ Builds an obelisk frontend as a static library for use in an iOS project. Check

Add this package to the [overrides](https://github.com/obsidiansystems/obelisk/#adding-package-overrides) in your obelisk project's default.nix:

````sh
mkdir dep
cd dep
nix-thunk create https://github.com/obsidiansystems/obelisk-ios-libfrontend.git
```
obelisk-ios-libfrontend = haskellLib.dontStrip (self.callCabal2nix "obelisk-ios-libfrontend" (hackGet ./dep/obelisk-ios-libfrontend + "/exe") {});
obelisk-ios-libfrontendconfig = self.callCabal2nix "obelisk-ios-libfrontendconfig" (hackGet ./dep/obelisk-ios-libfrontend + "/lib") {};

```nix
project ./. ({ pkgs, hackGet, ... }: {
...
overrides = self: super: {
obelisk-ios-libfrontend = pkgs.haskell.lib.dontStrip (self.callCabal2nix "obelisk-ios-libfrontend" (hackGet ./dep/obelisk-ios-libfrontend + "/exe") {});
obelisk-ios-libfrontendconfig = self.callCabal2nix "obelisk-ios-libfrontendconfig" (hackGet ./dep/obelisk-ios-libfrontend + "/lib") {};
};
```
Make sure to include `dontStrip`.
## Adding iOS config to your frontend code
Add `obelisk-ios-libfrontendconfig` to your frontend's `library`'s `build-depends` in `frontend/frontend.cabal`.
In your `frontend/Frontend.hs`, you'll need to add something like this:
```haskell
...
import Obelisk.Frontend.iOS
import Obelisk.Frontend.IOS
...
myHtmlHead = do
el "title" $ text "Obelisk Minimal Example"
elAttr "script" ("type" =: "application/javascript" <> "src" =: $(static "lib.js")) blank
elAttr "link" ("href" =: $(static "main.css") <> "type" =: "text/css" <> "rel" =: "stylesheet") blank
iosConfig :: IO (IosConfig (R FrontendRoute))
iosConfig = do
Expand Down

0 comments on commit 0b601fd

Please sign in to comment.