// Collapsable Mobile Menus

Code Customization

In a DIY community, there are always code customizations. Some of these have been captured for the convenience of those who want to make use of them.

Some customizations require a workspace build. With the advent of Xcode 13, the workspace build is now required but it may take a while for everyone to switch to the new method. The build steps in LoopDocs now make use of the Loop and Learn Build-Select script. If you use the Build-Select page to download and build Loop Master or the FreeAPS fork of Loop, you’ll have access to all the folders in the workspace. Plus, you’ll find it’s much easier to build – and faster.

    The line number(s) given for each customization might be in a different location – especially if you’re using someone else’s fork. If you get to the indicated line in the indicated file and don’t find code that looks exactly like that shown in a given customization instruction, use the Xcode / Find / (Find in Project OR  Find In Workspace) feature to search for the keyword and find the code. If you still don’t find it or are not sure – ask for help – do NOT guess.

    Some users prefer to search for the keyword instead of following the file tree in Xcode.

    These code customizations are found in LoopDocs, so head over there for details

    These code customizations are found on this site.

    Adjust Percent Bolus with Dosing Strategy of Automatic Bolus

    If you are mostly happy with the Dosing Strategy of Automatic Bolus but wish it delivered more insulin during every Loop interval, then this customization is for you.

    This customization changes the percent of the recommended bolus used for automatic delivery. The method for making that recommendation is not changed by this modification.  The default value is 40% (0.4).  It is recommended you take small upwards steps of 0.1 increase at a time.  Once you found the line and done the rebuild, it’s easy to go back in a week and creep up a little higher.

    • Keyword: bolusPartialApplicationFactor
    • Folder: Loop / LoopCore
    • File: LoopSettings.swift
    • Line: 80 (v2.2.4 automatic-bolus)
    • Line: 89 (v2.2.6 master)

    Original line:

        public let bolusPartialApplicationFactor = 0.4 // %

    Change just the number and double check that the value is less than 1.

    • Start with 0.5
      • 50% of the recommended dose immediately, then 50% of the remaining recommended dose (approximately 25%) is delivered 5 minutes later
    • Try it for a few days, then you can easily change it

    WARNING – This number should never be bigger than 1 (you’d be getting more than Loop recommends). If you think you need a number bigger than 0.7, perhaps you should examine your settings.

    Adjust Watch Crown Rotation Required for Bolus Confirmation

    If you find the amount of rotation of the crown too much to easily complete the bolus confirmation, this one is for you! This makes it easier for kids, teens, and some adults. Certain watch cases make spinning the crown more difficult as well, so reducing the rotation can be very helpful.

    This customization changes the rotation for confirmation from 1 full rotation (1.0 or 100%) to something less. I like to use 70% (or 0.7).

    • Keyword: previousAccumulatedRotation
    • Folder: Loop / WatchApp Extension / Controllers /
    • File: BolusInterfaceController.swift
    • Line: 311 & 360

    Original line 311:

        if abs(previousAccumulatedRotation) < 1.0 && abs(accumulatedRotation) >= 1.0 {

    Change both numbers to the desired amount, such as 0.7.

    Changed line to use 70% crown rotation:

        if abs(previousAccumulatedRotation) < 0.7 && abs(accumulatedRotation) >= 0.7 {

    Original line 360:

        if abs(accumulatedRotation) >= 1 {

    Changed line to use 70% crown rotation:

        if abs(accumulatedRotation) >= 0.7 {

    Pods: Increase Log File History Hours

    This customization increases the number of hours maintained by the Issue Report.  It is not specific to pods.  However, the only reason to do this if you are having issues with your pods not reaching full life and you’d like to reach out to the developers for help.  The default hours maintained is 48.  This customization increases that to 84.  This provides time for the pod to reach the full 80 hours and then 4 hours for you to remember you meant to capture an Issue Report. This will capture the full life of the pod from prime through replace with time to spare before and after the pod.

    This customization changes the number of hours for maintaining the log of Loop activities.

    • Keyword: deviceLog.getLogEntries
    • Folder: Loop / Loop / Managers /
    • File: DeviceDataManager.swift
    • Line: 201 (master), 204 (automatic-bolus or FreeAPS)


          self.deviceLog.getLogEntries(startDate: Date() - .hours(48)) { (result) in

    Change the 48 to 84 (or suitable number of hours that you typically use a pod).

    Everything below here requires a Workspace build

    Note that if you examine the folder names in the folder tree on the left side of Xcode, some folders do not match the detailed path on the right side for the Workspace build.

    For example, the top of the RileyLink folder tree on the left is RileyLink, while the full path to the right shows the actual path name on the mac, i.e., /Users/{your name}/Downloads/{more path info}/LoopWorkspace/rileylink_ios.

    This is normal – don’t let it confuse you. The actual folder name is shown below.

    Modify Override Sensitivity

    This requires a workspace build. 

    Some people want finer settings on the override sensitivity scale – especially for children.

    At the same time, any override more than a factor of 2 from 100% causes Loop predictions to be wrong – especially if a carb count is entered.

    This customization changes the lower bound for sensitivity to 50% (factor of 2 smaller than 100%) and provides 5% steps.

    • Keyword: allScaleFactorPercentages
    • Folder: LoopKit / LoopKitUI / Views
    • File: InsulinSensitivityScalingTableViewCell.swift
    • Line: 19

    Original line:

        private let allScaleFactorPercentages = Array(stride(from: 10, through: 200, by: 10))

    Change to:

        private let allScaleFactorPercentages = Array(stride(from: 50, through: 200, by: 5))

    Medtronic: Disable mySentry

    This requires a workspace build and is only needed for older code, i.e., Loop v2.2.4 and earlier; FreeAPS v2.1 (176) and earlier. Current versions of the code have this available as a selectable options in the pump menu where needed.

    Folks on Medtronic Pumps that have the mySentry feature (523, 554, 723, 754)  report battery draining rapidly on the radio-link.

    A fix has been reported in GitHub.

    This customization disables the mySentry feature, but will give you longer battery life AND fewer communications issues (less yellow/red loops, less bolus errors).

    • Keyword: hasMySentry
    • Folder: rileylink_ios/MinimedKit/Models
    • File: PumpModel.swift
    • Line: 54

    Original line:

        return generation >=23

    Change to:

        return false

    Pods: Add Extra Insulin on Insertion

    This requires a workspace build.

    The default value is 0.0 u of extra insulin.  It is strongly recommended that you start with a small number and work your way up.

    • Keyword: cannulaInsertionUnitsExtra
    • Folder: rileylink_ios/OmniKit/Model
    • File: Pod.swift
    • Line: 65


    public static let cannulaInsertionUnitsExtra = 0.0 // edit to add a fixed additional amount of insulin during cannula insertion

    Pods: Change Default Expiration Reminder

    This requires a workspace build.

    The default value is 2 hours before the 72 hour end of “guaranteed” life on the pod; this is measured from the time the insulin is injected into the pod. The range of allowed values is:

    • no smaller than 1 hour, i.e., remind at 71 hours
    • no bigger than 24 hours, i.e., remind at 48 hours

    The information needed to make the modification:

    • Keyword: expirationReminderAlertDefaultTimeBeforeExpiration
    • Folder: rileylink_ios/OmniKit/Model
    • File: Pod.swift
    • Line: 69


    public static let expirationReminderAlertDefaultTimeBeforeExpiration = TimeInterval.hours(2)

    The Pod has an internal timer that keeps track of minutes that the Pod has been active. This timer may have a slight drift with respect to actual time, so the 72 hour expiration beeps or the 80 hour Pod shutdown may be a few minutes before or after you expect it, based on this reported expiration date/time. However, the reminder is simply a iPhone notification – it will occur at the stated minute. And if the pod is replaced before the reminder – you might still get a reminder notification because this is based on an iPhone (not a pod) reminder function.

    Food Emojis

    This requires a workspace build.

    This customization allows you to move current emojis found on the carb entry screen to different absorption speed categories as well as add emojis to fit your usage.

    Many users find using Medium (3 hours) for some foods found in the Fast (2 hours) section improves meal management. For those with child loopers, adding new emojis and re-arranging emojis can be a great way to teach them how different foods affect them and how to pick the correct absorption time when they are working on self-management. Finally, those adjusting the default absorption times for fast/medium/slow, may wish to adjust these emoji classifications as well.

    You can move the emojis around, make a new line, or whatever you like. Just make sure each emoji follows the same pattern of being surrounded by double-quotes, followed by a comma.

    The information needed to make the modification:

    • Keywords: [double quote] [emoji] [double quote] [comma] [space]. Follow this format.
    • Folder: LoopKit/LoopKitUI/CarbKit
    • File: FoodEmojiDataSource.swift
    • Lines: 16-23, 31-33, 41-42, 50-53

    Examples of where you may want to move some emojis:

    Move doughnut and pie to slow. Move pancakes, bread, chocolate, and milk to medium

    Examples of emojis you may want to add:

    "🧃", "🥭","🫐" ,"🧋"
    "🥯", "🥚", "🧇",

    You can copy/paste emojis from an emoji website, like https://getemoji.com/.

    Patch for Ema and Orange Link Devices

    This requires a workspace build. It is suitable for Loop Master v2.2.6.

    As of FreeAPS v2.2 (203), the update is already incorporated, so consider a fresh download and build of FreeAPS instead of the patch.

    There were a number of updates related to the EmaLink and OrangeLink that did not make it into the release for Loop v2.2.6 or FreeAPS v2.2 (201) or (202). This has been documented at the link below – so head over there and follow the directions.

    • It is fairly easy to apply this patch (and the link documents all the things added with the patch)
    • It is recommended (as with all first-time customizations) that you first build the application as downloaded to make sure there are no build error and then apply the patch and repeat the build
    • Patch is found here: Updates Needed for Ema and Orange Displays

    Disable Suspend Beeps

    This requires a workspace build. 

    Some people requested the ability to suspend a pump without reminder beeps on the pod. (This safety feature was added in Loop v2.2.6, but there are no controls to determine when that beeps begin or how frequently it beeps, i.e., every 5 minutes. It can be silenced in the Pod Settings display after the first beep when the Alarm shows up.)

    This customization permanently silences the reminder beep when suspending a pod.

    • Keyword: usePodSuspendedReminder
    • Folder: rileylink_ios / OmniKit / PumpManager
    • File:PodCommsSession.swift
    • Line: 574

    Original line:

         let usePodSuspendedReminder = suspendTime == 0 || suspendTime > .minutes(5) // untimed or long enough suspend

    Comment out original line by putting “//” at the beginning and add new line:

         // let usePodSuspendedReminder = suspendTime == 0 || suspendTime > .minutes(5) // untimed or long enough suspend
         let usePodSuspendedReminder = false
    Skip to content