This file contains 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
let person1 = Person(name: "🐱") | |
let person2 = Person(name: "🦁") | |
let person3 = Person(name: "🐷") | |
person1.normalHello() | |
person2.strongHello() | |
person3.weakHello() | |
//結果 |
This file contains 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
class Person{ | |
var name: String | |
init(name: String) { | |
print("--- init \(name) ---") | |
self.name = name | |
} | |
deinit { |
This file contains 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
#!/usr/bin/swift | |
import Foundation | |
let env = ProcessInfo.processInfo.environment | |
let manager = FileManager.default | |
let fileNakami = """ | |
<?xml version="1.0" encoding=\"UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
This file contains 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
int りんご = 5; | |
int ばなな = 3; | |
int 合計 = りんご + ばなな; | |
NSLog(@"合計は%d",合計); |
This file contains 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
NSArray* クラス全員 = [[NSArray alloc] init]; | |
for( id 選ばれた人 in クラス全員){ | |
[選ばれた人 description]; | |
} |
This file contains 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
// タイ語 | |
int แอปเปิล = 5; | |
int กล้วย = 3; | |
int รวมทั้งหมด = แอปเปิล + กล้วย; | |
NSLog(@"รวมทั้งหมด %d",รวมทั้งหมด); | |
This file contains 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
// 韓国語 | |
int 사과 = 5; | |
int 바나나 = 3; | |
int 총 = 사과 + 바나나; | |
NSLog(@"총 %d",총); |
This file contains 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
ALAssetsLibrary* assetsLibrary = [[ALAssetsLibrary alloc] init]; | |
NSUInteger groupTypes = ALAssetsGroupSavedPhotos; | |
[assetsLibrary enumerateGroupsWithTypes:groupTypes usingBlock:listGroupBlock failureBlock:failureBlock]; |
This file contains 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
ALAssetsGroup *group; | |
[group setAssetsFilter:onlyPhotosFilter]; | |
NSInteger lastPhotoIndex = [group numberOfAssets]; | |
NSMutableIndexSet* photoIndexes = [[NSMutableIndexSet alloc] init]; | |
[photoIndexes addIndex:lastPhotoIndex-1]; | |
[group enumerateAssetsAtIndexes:photoIndexes options:nil usingBlock:assetsEnumerationBlock]; |
This file contains 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
[[NSNotificationCenter defaultCenter] | |
addObserver:self | |
selector:@selector(handleScreenCapture:) | |
name:UIApplicationUserDidTakeScreenshotNotification | |
object:nil]; |