Loop with Customization

Loop and Learn has created a customized branch of Loop 3 (main_lnl_patches) that enables people who want these customizations to easily add them. This is available with the Build Select script and using the GitHub (Browser Build) method.

LnL Customizations

The customizations added in the main_lnl_branch are:

  • CustomTypeOne LoopPatches
  • xDrip4iOS client
  • GlucoseDirect client
  • Loop and Learn Logo embedded in Loop Logo

The CustomTypeOne LoopPatches are one of the most requested customizations for Loop 3.

The two added clients support Libre as a CGM without the need for the internet, using either xDrip4iOS or GlucoseDirect. They both use the shared app group feature to talk to Loop.

The Loop and Learn Logo makes it easy to see that you have built from the customized branch.

CustomTypeOne LoopPatches

The CustomTypeOne LoopPatches are a popular set of patches that supply some features that are available in FreeAPS along with some new features implemented by Jon Fawcett.

These patches are enabled, disabled and adjusted through the iOS Setting -> Loop menu (not in the Loop app).

Thanks to the user who reported that Localized decimal separator is not supported.

When using mmol/L, use a period instead of a comma and check the correct threshold is selected.

If you use a comma in your value, such as 13,9 mmol/L, you won’t get an error but it will be interpreted as 13 mmol/L.

For more details than the quick summary provided below for items 2 through 5, please refer to Loop Patches Documentation.

To see the LoopPatches code and directions for applying the patches to Loop (main branch for release Loop, dev branch for Loop-dev), refer to LoopPatches.

  1. Add Now Marker, Main Charts
    • Display Feature
    • A vertical line is presented on each of the 4 main charts on the main Loop screen
    • This can be enabled or disabled (default)
  2. Automatic Strategy Switching
    • Switch Dosing Strategy from Temp Basal to Automatic Bolus at a glucose level you choose
  3. Negative IOB Factor
    • Restrict the insulin Loop doses for negative IOB to prevent rebound lows
    • This feature is disabled by selecting a factor of 100% (default setting is 1.0, same as 100%)
    • Note – this modifies what Loop records as IOB whenever IOB is negative
  4. Partial Bolus Application Factor
    • Adjust the percentage of recommended insulin that Loop delivers for each Automatic Bolus when that Dosing Strategy is selected
  5. Basal Lock
    • Prevent Loop from reducing or suspending insulin when you go over a set glucose value to assist with stubborn highs
    • Basal is “locked” to be no lower than the scheduled rate (overrides are ignored)
    • Use with care; meant for high glucose >250 mg/dL (13.9 mmol/L)
    • When used improperly, this can cause lows

For Loopers Using Libre as  CGM

What is a heartbeat and why should it come from a CGM?

For optimum performance, the app should be driven by the continuous glucose monitor (CGM) so the Loop cycle starts with the most recent glucose information available, updates the glucose prediction and then sends commands to the pump, if needed, to modify insulin delivery.

When the phone is locked, a mechanism is required to “wake” up the app out of background mode so it can keep that loop symbol a nice green color.

A Bluetooth connection is used by Loop to perform this waking from background while the phone is locked.  This is called the heartbeat.

  • Best case – this comes from the CGM (this is the case with Dexcom where app is on the Looper’s phone)
  • Second best case – this comes from the RileyLink device (for Eros or Medtronic)
  • With DASH pods, there is no reliable heartbeat that works all of the time when the phone is locked

In order to solve this problem, the folks who work with Libre sensors make the Bluetooth connection available to Loop. This is an area where more progress may happen, but for now, it is xDrip4iOS that has this feature working with Loop. Follow the heartbeat instructions below to get best performance using Libre and allow continued looping while phone is locked.

Using xDrip4iOS heartbeat

Users of Libre with xDrip4iOS now have the heartbeat option (allows Loop to work with the phone locked).

Instructions for use:

Loop with customizations has an option to make a bluetooth connection to the CGM transmitter, which will then work as a heartbeat.

It is disabled by default. Can be enabled in xDrip4iOS user interface (UI).

Note for Libre 2 users : the reading will run 1 minute behind.

If you haven’t setup your CGM yet in xDrip4iOS :

  • Force close Loop
  • In xDrip4iOS make sure you have made a first connection to the CGM
  • Force close xDrip4iOS
  • Reopen Loop
  • Select xDrip4iOS as CGM and open the xDrip4iOS UI (within Loop)
  • Enable “use CGM as heartbeat”
  • Keep the app in the foreground and wait till the text under the UISwitch changes to
    • Did connect to CGM, You can now run both xDrip4iOS and Loop
  • Once you see this text, you can reopen xDrip4iOS

GitHub Build: Loop with Customization

These instructions enable you to build Loop with the customizations discussed above using a browser. No Mac or Xcode needed. If you need more details than are provided here, the LoopDocs GitHub First-Time page has step-by-step directions with graphics for doing this for the released version of Loop. Review that and then return here.

If you’ve already built released Loop with GitHub

Your first step is to delete your current fork of LoopWorkspace and start over – but trust us – it will be much easier than the first time.

Delete your fork of LoopWorkspace from your account.

  • Instructions to delete a repository are found at GitHub Docs

You will use the same Secrets again with the new fork from the loopnlearn GitHub account (see below). The secrets are associated with your Apple Developer ID and your GitHub account. Keep them safe in a text-only file – they need to be the same for any repository that uses this method.

Follow the directions below to get your new fork, skipping the parts that you’ve already completed.

If you’ve never built Loop using GitHub

Follow the instructions in LoopDocs until you complete the section entitled Create Match-Secrets.

Do not follow the directions for creating your fork of LoopWorkspace – come back to this page.

Fork the loopnlearn LoopWorkspace

Click on this link https://github.com/loopnlearn/LoopWorkspace to open the LoopWorkspace repository.

Click on the fork button (TO DO: add more detail here but not as much as LoopDocs).

Successful Fork

After you have successfully forked LoopWorkspace from loopnlearn and see that you have the main_lnl_patches branch, return to the Loopdocs instructions at Configure Secrets.

If you have never built Loop with the GitHub method, continue to the end of the LoopDocs instructions because you have some additional steps to accomplish.

If you previously built Loop with the GitHub method, once you’ve added your 6 secrets, run these 3 actions:

  1. Add Identifiers
  2. Create Certificate
  3. Build Loop


The final step is to make sure your app is connected to TestFlight so you can install it on your phone. Follow instructions to Set Up Users and Access TestFlight.


Look for the TestFlight email – you will have to redeem the invitation the first time it built using GitHub for a given app.

Skip to content