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 Foundation | |
enum FileError: Error { | |
case fileNotFound | |
case dataReadError(Error) | |
} | |
func loadMp3DataFromBundle(fileName: String, fileExtension: String = "mp3") -> Result<Data, FileError> { | |
// 1. バンドルからファイルのURLを取得 | |
guard let fileURL = Bundle.main.url(forResource: fileName, withExtension: fileExtension) else { |
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
もちろん、以下が **Kotlin Multiplatform (KMP) プロジェクトで `git submodule` を使って別の KMP プロジェクトを参照する方法** の Markdown 形式のまとめです。 | |
--- | |
# Kotlin Multiplatform プロジェクトで git submodule を使って他の KMP プロジェクトを参照する方法 | |
## 前提 | |
- **メインプロジェクト**: `MainKMPProject` | |
- **サブプロジェクト(参照元)**: `SubKMPProject`(Git リポジトリ管理されている) |
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
GitHub Packages に Kotlin Multiplatform ライブラリを組織内限定で公開する方法(ステップバイステップ) | |
1. GitHub リポジトリを用意 | |
- Organization 内にリポジトリを作成 | |
- リポジトリは「Private」に設定(パッケージも限定公開になる) | |
2. build.gradle.kts に以下を追加 | |
publishing { |
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
Kotlin Multiplatform ライブラリをローカルで開発&使用する手順(Android Studio Meerkat対応) | |
Kotlin Multiplatform(KMP)でライブラリを作成し、ローカル環境で開発&別プロジェクトから利用する方法を解説します。 | |
この記事では、Android Studio Meerkat (2024.3.1 Patch 1) を使って、mavenLocal() にパブリッシュしたKMPライブラリを、 | |
他のプロジェクトから呼び出して使えるようにするまでをステップバイステップで紹介します。 | |
【ゴール】 | |
- Kotlin Multiplatformライブラリ(JVM対応)を作成 | |
- mavenLocal() に公開 |
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
# coding: UTF-8 | |
import urllib.request, urllib.error | |
from bs4 import BeautifulSoup | |
# アクセスするURL | |
url = "http://www.nikkei.com/markets/kabu/" | |
# URLにアクセスする htmlが帰ってくる → <html><head><title>経済、株価、ビジネス、政治のニュース:日経電子版</title></head><body.... | |
html = urllib.request.urlopen(url) |
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
# coding: UTF-8 | |
import urllib.request, urllib.error | |
from bs4 import BeautifulSoup | |
# アクセスするURL | |
url = "http://www.nikkei.com/" | |
# URLにアクセスする htmlが帰ってくる → <html><head><title>経済、株価、ビジネス、政治のニュース:日経電子版</title></head><body.... | |
html = urllib.request.urlopen(url) |