: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<title>CodeMirror: Swift mode</title>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../../addon/edit/matchbrackets.js"></script>
<script src="./swift.js"></script>
.CodeMirror { border: 2px inset #dee; }
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">Swift</a>
<form><textarea id="code" name="code">
// TipCalculatorModel.swift
// Created by Main Account on 12/18/14.
// Copyright (c) 2014 Razeware LLC. All rights reserved.
class TipCalculatorModel {
return total / (taxPct + 1)
init(total: Double, taxPct: Double) {
func calcTipWithTipPct(tipPct: Double) -> Double {
func returnPossibleTips() -> [Int: Double] {
let possibleTipsInferred = [0.15, 0.18, 0.20]
let possibleTipsExplicit:[Double] = [0.15, 0.18, 0.20]
var retval = [Int: Double]()
for possibleTip in possibleTipsInferred {
let intPct = Int(possibleTip*100)
retval[intPct] = calcTipWithTipPct(possibleTip)
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
<p>A simple mode for Swift</p>
<p><strong>MIME types defined:</strong> <code>text/x-swift</code> (Swift code)</p>