2020年4月23日木曜日

to clean MacOS Xcode CoreSimulator device folder


When macos strage usage was getting bigger and you are using Xcode, to clean the simulator folder  is going to help free up your strage space.
more info

$xcrun simctl delete unavailable

2020年4月22日水曜日

SwiftUI data visualization, ploting library

One of useful  plot library for SwiftUI

https://github.com/KanshuYokoo/SwiftUIGraphPlotLibrary
It is very nice library to plot data on SwiftUI project ad seem to work on both iOS and MacOSX



2020年4月14日火曜日

swift, useful example of keypath


extension Sequence {
    func sorted<T: Comparable>(by keyPath:KeyPath<Element, T>) -> [Element]{
        return sorted {a, b in
            return a[keyPath: keyPath] < b[keyPath:keyPath]
        }
    }
    
    func map <T> (_ keyPath: KeyPath<Element, T>) -> [T] {
        return map {$0[keyPath: keyPath]}
    }
    
    func min <T: Comparable> (_ keyPath: KeyPath<Element, T>) -> T? {
        return map(keyPath).min()
    }
    
    func max<T: Comparable> (_ keyPath: KeyPath<Element, T>) -> T? {
        return map(keyPath).max()
    }
    
}

2020年4月2日木曜日

WSL2 - npm install : pm ERR! code: 'EACCES',

Tring to install npm package by

$ npm install

There were many errors with the code
npm ERR!      code: 'EACCES'

the solution is

$npm config set unsafe-perm=true

Tring the npm install again and it succeeded.