This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recognitionRequest = SFSpeechAudioBufferRecognitionRequest() | |
let inputNode = self.getInputNode() | |
guard let recognitionRequest = recognitionRequest else { fatalError("Unable to created a SFSpeechAudioBufferRecognitionRequest object") } | |
// Configure request so that results are returned before audio recording is finished | |
recognitionRequest.shouldReportPartialResults = true | |
let recognizer = SFSpeechRecognizer(locale: Locale(identifier: (self.localeIdentifier)!)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup input source | |
let audioSession = AVAudioSession.sharedInstance() | |
do { | |
//try audioSession.setCategory(AVAudioSessionCategoryRecord, with: .allowBluetooth) | |
try audioSession.setCategory(AVAudioSessionCategoryRecord) | |
try audioSession.setMode(AVAudioSessionModeMeasurement) | |
try audioSession.setActive(true, with: .notifyOthersOnDeactivation) | |
} catch { | |
print("audioSession properties weren't set because of an error.") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>NSMicrophoneUsageDescription</key> <string>Your microphone will be used to record your speech when you press the "Start Recording" button.</string> | |
<key>NSSpeechRecognitionUsageDescription</key> <string>Speech recognition will be used to determine which words you speak into this device's microphone.</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unused variable | |
int hello = 999; | |
// short variable name | |
int a = 1; | |
// long variable name | |
int a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789g0123456789h0123456789i0123456789j0123456789k0123456789k0123456789l0123456789m0123456789n0123456789o0123456789p0123456789q0123456789r0123456789s0123456789t0123456789u0123456789v0123456789w0123456789x0123456789y0123456789z0123456789 = 123; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <AVFoundation/AVAudioSession.h> | |
- (void) demonstrateInputSelection | |
{ | |
NSError* theError = nil; | |
BOOL result = YES; | |
AVAudioSession* myAudioSession = [AVAudioSession sharedInstance]; | |
result = [myAudioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&theError]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define object | |
class LeakObject: NSObject { | |
var node:LeakObject? | |
var name:String = "" | |
init(_ name:String) { | |
super.init() | |
self.name = name | |
self.name == "" ? () : print("Init object - \(self.name)") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define object | |
class LeakObject: NSObject { | |
var node:LeakObject? | |
var name:String = "" | |
init(_ name:String) { | |
super.init() | |
self.name = name | |
self.name == "" ? () : print("Init object - \(self.name)") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
@testable import DemoWeak | |
class DemoWeakTests: XCTestCase { | |
override func setUp() { | |
super.setUp() | |
// Put setup code here. This method is called before the invocation of each test method in the class. | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 安裝 Homebrew | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# 安装 OCLint | |
brew tap oclint/formulae | |
brew install oclint | |
# 安裝 xcpretty | |
gem install xcpretty |