HighlightCode Sample

This sample supports light and dark mode. The syntax highlighting engine is highlight.js, and the styles are generated by HighlightCode. Below are some syntax highlighting samples with the Xcode 11 default light and dark themes.

CSS


@import url("//cdn.jsdelivr.net/gh/tonsky/FiraCode@2/distr/fira_code.css");

.hljs {
    display: block;
    overflow-x: auto;
    padding: 0.5em;
    font-family: 'Fira Code', monospace; 
    font-size: 12.75px;
}
        

Swift

The following code is copied from Apple's Swift examples.


let minValue = UInt8.min  // minValue is equal to 0, and is of type UInt8
let maxValue = UInt8.max  // maxValue is equal to 255, and is of type UInt8
let decimalDouble = 12.1875
let exponentDouble = 1.21875e1
let hexadecimalDouble = 0xC.3p0
let oneMillion = 1_000_000
let justOverOneMillion = 1_000_000.000_000_1
// This is a comment.
/* This is also a comment
but is written over multiple lines. */
let cat = "🐱"; print(cat)
// Prints "🐱"
if turnipsAreDelicious {
    print("Mmm, tasty turnips!")
} else {
    print("Eww, turnips are horrible.")
}
        

Markdown


## Heading Two

This is markdown text. It has a [link](https://example.com), _emphasized_ text, and **strong** text.

```c
// simple program
int main() {
    return 0;
}
```

Some compilers will compile `main() {}` the same way as the above block.
        

Diff


--- a/BiometricKit/BiometricKit.h
+++ b/BiometricKit/BiometricKit.h
@@ -1,13 +1,29 @@
  #import "BiometricKitDelegate.h"
+ #import "BiometricKitIdentity.h"
  
+ API_AVAILABLE(ios(7.0))
  @interface BiometricKit : NSObject

  + (BiometricKit *)manager;
  
  @property (nonatomic, assign) id delegate;
+ @property (assign) BOOL inUse;
  
- - (NSArray *)identities:(id)object;
+ // research on iOS 10.2 shows `options` supports { "BKFilterIdentity" : BiometricKitIdentity }
+ - (NSArray *)identities:(NSDictionary *)options;
  
- - (BOOL)isTouchIDCapable;
+ - (float)getModulationRatio;
+ 
+ - (BOOL)isTouchIDCapable API_AVAILABLE(ios(10.0));
+ - (BOOL)isFingerOn API_AVAILABLE(ios(9.0));
+ 
+ - (NSData *)getCalibrationDataInfo API_AVAILABLE(ios(9.0));
+ - (NSData *)getSensorInfo API_AVAILABLE(ios(9.0));
+ 
+ - (NSUUID *)getIdentitiesDatabaseUUIDForUser:(uid_t)user API_AVAILABLE(ios(10.0));
+ - (NSData *)getIdentitiesDatabaseHashForUser:(uid_t)user API_AVAILABLE(ios(10.0));
+ 
+ - (NSUUID *)getIdentitiesDatabaseUUID API_DEPRECATED("getIdentitiesDatabaseUUIDForUser:", ios(9.0, 10.0));
+ - (NSData *)getIdentitiesDatabaseHash API_DEPRECATED("getIdentitiesDatabaseHashForUser:", ios(9.0, 10.0));

  @end
        

fin